obsidianmd / obsidian-importer

Obsidian Importer lets you import notes from other apps and file formats into your Obsidian vault.
https://help.obsidian.md/import
MIT License
700 stars 64 forks source link

[OneNote] Code 201 import string is incorrect and may be missing data #199

Open SSzretter opened 8 months ago

SSzretter commented 8 months ago

I have several pages that fail to import with this error:

because Error: The input string is incorrect and may be missing data. Inputted string: {"error":{"code":"201...

One of the pages is very simple and has just a few words in it and 3 web page links.

It looks like it is creating folders for the notes and the issue might be if there is a question mark or other unacceptable windows filesystem character in the note name. If that is the case it might be good to add some kind of character replacement logic.

johnwun commented 7 months ago

Same issue. 225 of 400 files failed. Looking at the source code: line 303 of onenote.ts

The function appears to expect the input to contain exactly 2 parts, and for some reason, it does not. This looks like the only reason this specific error would be thrown.

(Update) I re-imported a single folder instead of all my folders, and opened Obsidians network console, and it appears that for any note that does not have an implicit title, the importer uses the notes body as a title instead, resulting in silly .md file names like:

This morning I went to the store and had an everything bagel. It was an unusually delicious bagel. It had lots of garlic, and I said "Yum, what a great way to start the day!".md

In such cases, it might be good to instead, just name the imported file 'untitled.md'

Note the error I see now is ENOENT: no such file or directory, so maybe the parent issue is somehow related to importing multiple folders at once. I'm importing the same data that failed yesterday, but I'm not seeing the 201 errors at all now. Hopefully this helps.

(Final edit) The last 27 files all failed with 201, but in the console, the underlying error was: The app has issued too many requests on behalf of this user in a short time So I think the 201 error is occurring because the importer is trying to parse the error object.

So, at least in my case, I can track the 201's to just too many files at once. This would make sense because yesterday I tried importing a lot more.

kirilswenson commented 6 months ago

I'm also getting this error and I think it's because OneNote's ratelimiting me (to echo what johnwun said). Try waiting a bit and importing stuff one by one

mattsteg commented 6 months ago

I encountered this as well, plus images attached in onenote notes showing up in wildly inappropriate locations. Importing honestly feels a bit hopeless.