Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in Syncing - APIResponseError: body failed validation #463

Open
colettembrown opened this issue Feb 1, 2024 · 5 comments
Open

Error in Syncing - APIResponseError: body failed validation #463

colettembrown opened this issue Feb 1, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@colettembrown
Copy link

colettembrown commented Feb 1, 2024

Describe the issue
I am receiving an error about the type of notes I'm adding into a zotero notes document that I want to sync with Notion. My Notion and Zotero sync any paper that I add my specific folders that are connected via the integration. When I add anything to my notes document I get the following error:

APIResponseError: body failed validation: body.children[6].numbered_list_item.children[2].numbered_list_item.children[0].numbered_list_item.children should be not present, instead was [{"numbered_list_item":{"rich_text":[{"text":{"content"...."

And then when I look in Notion there are dozens of "Zotero Notes" dropdowns with the first item under the heading that I included in my Zotero notes.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Zotero
  2. Click on an article
  3. Click on the notes section for an article
  4. Write Anything
  5. receive the error message
  6. check my notion to see that my paper exists in my database
  7. notion paper exists, click inside the database
  8. check what is under "Zotero Notes"
  9. sees "Goals" dropdown

Expected behavior

  1. Go to Zotero
  2. Click on an article
  3. Click on the notes section for an article
  4. Write Anything
  5. check my notion to see that my paper exists in my database
  6. notion paper exists
  7. click inside the database
  8. check what is under "Zotero Notes"
  9. see the notes I added in zotero

Screenshots
Screenshot 2024-02-01 at 11 21 05 AM
Screenshot 2024-02-01 at 11 21 05 AM (2)

Additional context
Add any other context about the problem here.

@dvanoni dvanoni added the bug Something isn't working label Feb 2, 2024
@dvanoni
Copy link
Owner

dvanoni commented Feb 2, 2024

Hi @colettembrown, thanks for reporting this! I can see there are a couple issues occurring here.

API error caused by deeply-nested blocks

The first issue is the API error that's causing the note to fail to sync. You're encountering a limitation of the Notion API which I haven't had a chance to work around yet. Specifically, the API only allows blocks nested at most three levels deep. In this case, the error is being caused by the numbered list with four levels of nesting starting at "Support Vector Machines."

I believe the note should be able to sync if you're able to remove that fourth level from all your lists, but that's obviously not an ideal solution. To make this actually work as desired, we'll have to:

  1. find all the blocks that are nested beyond three levels
  2. omit those deeply-nested blocks from the initial request
  3. submit follow-up requests to add each of the deeply-nested blocks

It's going to be tricky, and I haven't yet figured out how to approach it. Until I can solve it, I'm afraid the only workaround is to reduce the nesting in your notes.

Duplicate "Zotero Notes" blocks

The second issue is a side-effect of the first one. When Notero encounters the API error, it doesn't currently handle it as gracefully as it could and leaves a mess behind in Notion as you've seen.

I think I can improve this error handling so that you don't end up with a bunch of duplicate blocks in Notion. Luckily, I think this should be easier to solve than the other issue. In the meantime, feel free to delete all those "Zotero Notes" blocks.

@dvanoni
Copy link
Owner

dvanoni commented Feb 5, 2024

Hi @colettembrown, I've just released a new version (0.5.15) that contains a fix for the duplicate "Zotero Notes" blocks.

If you delete all the duplicate blocks currently in Notion, Notero should now correctly manage just a single "Zotero Notes" block. Unfortunately, your note will still fail to sync until I come up with a fix for the more complex issue here. But, once I do have a fix in place, Notero should sync that note into the correct place in Notion.

Please let me know if this first fix is working for you!

@colettembrown
Copy link
Author

Hi @dvanoni I am no longer getting the duplicate "Zotero Notes" blocks, and I deleted the old ones.

It works for me to just remove some of the deeply-nested blocks, and work in 1-2 levels of writing. When you say any block nested beyond three levels, does this mean I can do this below, and not get an issue?

  1. one level
    A. two levels
    i. three levels

Thank you for being so quick to respond and fix one of these issues!!

@dvanoni
Copy link
Owner

dvanoni commented Feb 6, 2024

@colettembrown, I'm glad that first fix is working for you!

And yes, you're correct about what should work without issue. Just to be super clear:

This should work This should fail
  1. one level
    1. two levels
      1. three levels
  1. one level
    1. two levels
      1. three levels
        1. four levels

@colettembrown
Copy link
Author

Thank you for clarifying!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

2 participants