Zotero stopped working in a Google Doc (that is previously worked in)


I used Zotero in a Google Doc a few months ago, and generally had no problems. I have come back to it now, and whenever I try to input a citation from the "Add/edit citation" button I get a very long and uninterpretable error. I have tried turning off the automatic sync function and citing different sources but the same thing happens every time.

Other information: I tried inserting a citation into a new and empty Google Doc and it worked fine, however when I make a copy of the doc I am working on, it does not work in there either. Also I have restarted chrome (the browser I'm using), my computer, and Zotero, and have checked that Zoetero is up to date. Also, potentially unrelated, whenever I cut and paste something in my current document (even if it has nothing to do with a citation or Zotero) I get a message that says "Zotero is updating your document. Please wait…".

I would very much appreciate any help, I have a big deadline coming up and it would be great to get this working ASAP. Thank you in advance!

bug report number: 1712296414

  • What is the error you see in your original document? Could you submit a Report ID from Zotero Connector?
  • Thanks for the response @adomasven! I filed a report through Zotero Connector and the associated number is 1712296414. The error is so long that I can’t see all of it even if I zoom all the way out so it will be difficult to post. Let me know if having that bug report ID/number is enough, or if I should look for other information to post here. Thank you!
  • Do you use any other Google Docs extensions or plugins on this document?
  • edited March 18, 2019
    Nope, just Zotero as far as I know!
  • I went back to the error reporting page which I realized shows the full error. It starts with this:

    `[JavaScript Error: "Error: Ranges corrupt on Z_F4fWRXB000.

    and then has code for a specific citation and then at the end of that citation says:

    ` at Code (Zotero Google Docs Integration):219 (decodeRanges)
    at Code (Zotero Google Docs Integration):580
    at Code (Zotero Google Docs Integration):123
    at Code (Zotero Google Docs Integration):104 (getFields)
    at Code (Zotero Google Docs Integration):355
    at Code (Zotero Google Docs Integration):72 (callMethod)`.

    This repeats multiple times but as far as I can tell it is the same error over and over again. Hope that is more informative and thanks for your help!
  • Could you troubleshoot for when this problem first started?

    1. Go into the document revision history (File -> Version History -> See Version History)
    2. Find a revision somewhere in the middle of the long list of revisions. Click the "..." icon and make a copy. In the copy check with Zotero whether you can perform an action that was previously broken.
    3a. If broken go back to the original list of revisions and find the approximate midpoint-revision between the one you tested before and the oldest one. Make a copy and check whether it is no longer broken.
    3b. If not broken go back to the original list of revisions and find the approximate midpoint-revision between the one you tested before and the newest one. Make a copy and check whether it is broken.
    4. Keep on performing the step 3. If a revision is broken, try to find an earlier not broken one, and if it is broken, try to find a later broken one, until you are left with a single change.

    Please specify/explain what changed in the revision that produced the broken state. Note that the process of halving the number of revisions to check should not take more than 11 or 12 steps even if you have something like 1000 revisions.
  • Ok, I did what you said and here's what I found.

    The broken document is actually a copy of a document that worked but it seems that this one never has. I went back to the earliest version of the document I'm working in, made a copy, and tried to insert a citation. I got a new error that said:

    CSL error
    TypeError: this.registry.citationreg.citationById[c[0]] is undefined
    atarray citationsPre index 0, from citation at document position 1

    Then I went back to the newest version of the document that I created a copy from and successfully made a citation in there, but when I try to make another the loading bar is so slow that it doesn't work and I just have to quit Zotero (but no error). Any advice?Are there often problems associated with making copies of documents with citations? When I did it I just clicked "duplicate" I didn't copy and paste across docs. Thanks!
  • Making copies of the document should not cause any issues, although Google Docs has not been tested as much as Word and LibreOffice have over the years, so anomalies are possible. I have been successfully copying google docs while preserving citing integrity with my own testing. If you restart Zotero does the document that throws the "CSL Error" begin working? How about the document where you managed to insert a citation? If that document just continuously hangs could you produce a Debug ID from the Zotero Connector?

    1. Open the Zotero Connector preferences
    2. In the Advanced tab of the Zotero Connector preferences, check the box next to “Enable Logging.” Do not close this tab.
    3. Begin a google docs procedure that takes a long time and wait at least 10 minutes.
    4. Go back to the Advanced tab of the Zotero Connector preferences, uncheck "Enable Logging" and click Submit to Zotero Server.
    5. You will be provided with a Debug ID (e.g., “D12345678”). Please post the Debug ID in this thread.
  • edited March 19, 2019
    Thanks! I did the "enable logging" thing and my Debug ID is D686869821. Unfortunately, restarting Zotero did not fix the document with the CSL Error.

    Also, would it help to uninstall the chrome extension and reinstall it? I am nervous because I get an error when I try to unlink citations (in a copied document) and I don't want to lose all of my work if something goes wrong with the extension. Do you think this (uninstall/reinstall) might help, or is it not worth it?

  • Any more advice on this? Would appreciate any and all insights as I have a big deadline approaching and a working Zotero would make it a lot easier. Thanks!
  • I do not know what is going on in the Debug ID you have submitted. It seems that you triggered a command in one document, an error was returned and Zotero (tried to?) display a prompt, which you didn't dismiss, after which you tried triggering the integration on other docs but Zotero was waiting for the initial command to be finalized (i.e. for the prompt to be dismissed).

    I've noticed that all your codes are duplicated three times in the document somehow, so you might have luck by running this function in google doc's script editor on your latest revision of the document:
    1. In Google Docs: Tools -> Script Editor
    2. Overwrite the contents of the editor with this function and save the script
    3. Run -> Run Function -> removeDuplicateRanges

    This might prompt google to do some additional authorization steps for the code, publish it and google might at one point say that your published script is unsafe. You should proceed. After running the script try editing the doc with Zotero again.

    If this does not help and you do not have the document before the copy with older revisions to check for when the corruption occurred then it is likely there is little that can be done for this document aside from starting from scratch regarding citations.
  • edited March 20, 2019
    I saved and tried running the code you sent and it started running and then gave me this error:

    Too many changes applied before saving document. Please save changes in smaller batches using Document.saveAndClose(), then reopen the document with Document.openById().

    It doesn't seem too difficult but I'm not sure how to incorporate it into the code. Any advice? Thanks again!
  • I have updated the function in the link above. You can try it again.
  • Great, thanks so much! How long might you expect it to take to run? It has been going for about 30 minutes so far
  • Depends on the length of the document and the number of citations. How big is it?
  • Hey, just wanted to say I had the same problem and the script solved it. Thanks a lot!
  • I also had the same problem (the symptoms of non-working menu, didn't check the log), but for me it was sufficient to make a copy of the document and to use that copy instead.
Sign In or Register to comment.