Bad Error Message! Bad! Bad!


I was xcopying some folders this weekend. (xcopy: the poor man’s backup system.) Everything was going swimmingly. Or so I thought, until I noticed that some files that should have been copied weren’t.

What!? xcopy has never failed me before! What’s going on?

So I tried it again, more targeted than the original command since I knew about where it stopped working.

“Insufficient memory.”

???

Does it mean the destination drive is full? No, there’s plenty of space left. Does it mean I’m trying to copy too many files at once? This particular set of files is much smaller than others that copy just fine, so probably not.

I binary searched my way down the file system trying to identify which files were causing the problem. Eventually I narrowed in on one particular folder that seemed to be the culprit. If I deleted it, the original command worked. If I xcopy’d just that folder, I got the error.

Hmmm…how was this folder different from the others that worked? I tried various things but didn’t see any pattern. I suspect that the problem is related to folder name and/or file name length but was unable to confirm that suspicion. Finally I gave up and just copied that folder manually.

I would call this a bug in xcopy. If I am hitting some maximum path length (hmmm…MAX_PATH perhaps?) then it may actually be spec’d behavior that seemed reasonable back in DOS days and has never been updated since. Regardless, “Insufficient memory” is a very ambiguous error message. In this case I think it’s not even correct, but I really don’t know. This is almost as useless as the message box I once received that contained no caption and no contents whatsoever except for an OK button. Error messages like these drive users nuts.

This is why basing feature work on user scenarios is so important: you have to understand what the user is attempting to do in order to build something they will use. This however is also why thinking outside the spec is incredibly important if you want a well-tested feature: you know what the spec says the feature should do, but your customers don’t know this nor do they really care. Customers are going to use (abuse) that feature in amazing ways. Each time they think of something that you haven’t they are going to run into bugs, some of which will be heinous enough to make that customer defect to your competitor. This is a Bad Thing — in my world, at least.

Test until you’re confident that you’ve  found every last bug, then be prepared to help your customer when they find one you missed. Because you’ve never found them all.


*** Comments, questions, feedback? Want a fun job on a great team? Send two coding samples and an explanation of why you chose them, and of course your resume, to me at michhu at microsoft dot com. I need a senior tester and my team needs program managers. Great coding skills required for all positions.

Comments (6)

  1. http://www.Xxcopy.com

    has a super duper xcopy that is more reliable, more powerful, more versatile.

  2. Jeff Parker says:

    You know I ran into this as well, I can’t remember the exact reason but I did figure out why, I remember not understanding why. This is a rough jog on my memory but I originally remember because it crashed one of my apps that was accessing the files in one of these directories and went to do a copy on the direcory from code and my app was crashing. Took forever to figure it out. However it led me down the lines of some hidden file, and I mean hidden, completely hidden file from MS was in that folder, and locked by some background thread.

    Now what I mean by hidden is like the thumbnail image database put inside folders by the OS. if I remember right the file name is thumbs.db. You can not see this file, even if you select show hidden files on Windows XP SP2. You can not see this file by doing dir at the command prompt either. But it is there in any directory that you set to display imageas as thumbnails. If you go at the windows API or even in .net and do System.IO.Directory.GetFiles() it will show up. And if you try to delete that file more than likely an exception will be thrown.

    Anyway, the cause of my woes was some file in the directory was hidden by MS like that. And something somewhere didn’t like the fact that the file even existed. I probably wouldn’t have discovered this if I did what I would consider half assed programming. My App moved files to a new folder. Well as we know anything can happen anytime, so my app in reality copied the files to the new directory then deleted the originals. Well when I went to delete the originals on a folder with the hidden file in it, my app through an exception, it really took me a long long time to figure out there was a hidden file there hidden from even the command prompt.

  3. AndrewSeven says:

    Looking fo bad error messges?

    Try Commerce Server 😉

  4. Talk about synchronicity. I had exactly this problem yesterday. In the end I decided that I didn’t actually need the files anyway, so I gave up on them.

    Of course, you’ve then got the other side of the coin, where Windows Explorer gives up on the whole bunch of files just because it can’t read one of them…

  5. DustyDog says:

    Xcopy seems to have a problem with the number of files that are in a dir that you are going to copy. I have found the after Temp internet files is when I get the error. Try to have fewer files per dir and see if that dont help you….

  6. Thanks for the suggestion! However, I only had about ten files in the folder. I’ve since had this same problem with another folder whose path+filename was very long, so I’m pretty certain I’m hitting a maximum path+filename size.