The given key was not present in the dictionary
-
25-01-2021 - |
Question
I took a list from 1 site collection, templated it with data. Downloaded the template and uploaded it into another collection.
I created a list using this template and it looks like it's working and the documents are set up properly etc. But when I try to query the list using PNPJS or a simple /items endpoint I get this error:
code:"-1, System.Collections.Generic.KeyNotFoundException"
message:
{lang: "en-US", value: "The given key was not present in the dictionary."}
lang:"en-US"
value:"The given key was not present in the dictionary."
The original list did have Document ID enabled and that feature is enabled in the collection I copied it into. Wondering if the copied list is conflicting because there's now two documents with the same id maybe?
Solution
There was a broken lookup in my list. When you create a template which contains a look up, and copy it into a different site, the referenced list no longer exists. The list gets created without problem, however you need to delete the lookup field for it to work properly.