I have this strange tendancy as a developer to not trust any error message that gets generated. They're usually indicative of symptoms, but rarely actually tell you exactly what's wrong. Which is why I'm feeling a bit stupid this morning.
I was refreshing a template of a test database on a customer site, after changing many things. The customer reported ("reported" makes it sound a lot more friendly than it actually was) an error when trying to create a document using a form I hadn't touched. The error was quite simply: "4412 Notes Error - Cannot locate Default Form". Very weird. So I spent a little while testing on our version - no problems there. I checked the templates to make sure they had been created properly (the template is a combination of a couple of other templates), I generated a new template and refreshed their database a few more times (over a painfully slow link), but still no joy. I then spent a bit of time stepping through the code - again, very painful over a slow link. This code also has a lot of calls, and a lot of code in hidden libraries, so you kind of want to step through it slowly just in case it's one of those causing the error. Still no real clue as to whats causing the problem.
So.. finally.. for some reason I opened the customers database in Designer, and what do you know - there was no default form set. Somehow, the design refresh had removed this property on the form, so the NotesUIWorkspace.EditDocument call was failing. Fuck me if the error message was exactly what the problem was.