{"record":{"id":"25852890fecf2cb7","repo":"facebook/relay","slug":"did-not-find-item-with-data-id-id-in-the-stor","errorCode":null,"errorMessage":"Did not find item with data id ${__id} in the store.","messagePattern":"Did not find item with data id (.+?) in the store\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/relay-runtime/mutations/createUpdatableProxy.js","lineNumber":229,"sourceCode":"      throw new Error(\n        'Do not assign null to plural linked fields; assign an empty array instead.',\n      );\n    } else {\n      const recordProxies = newValue.map((item): ?RecordProxy => {\n        if (item == null) {\n          throw new Error(\n            'When assigning an array of items, none of the items should be null or undefined.',\n          );\n        }\n        const {__id} = item;\n        if (__id == null) {\n          throw new Error(\n            'The __id field must be present on each item passed to the setter. This indicates a bug in Relay.',\n          );\n        }\n        const newValueRecord = recordSourceProxy.get(__id);\n        if (newValueRecord == null) {\n          throw new Error(\n            `Did not find item with data id ${__id} in the store.`,\n          );\n        }\n        return newValueRecord;\n      });\n      updatableProxyRootRecord.setLinkedRecords(\n        recordProxies,\n        selection.name,\n        newVariables,\n      );\n    }\n  };\n}\n\nfunction createSetterForSingularLinkedField(\n  selection: ReaderLinkedField,\n  variables: Variables,\n  updatableProxyRootRecord: RecordProxy,","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/facebook/relay/blob/668b1b85e06261aa3b58dabfc51f8b5524a70955/packages/relay-runtime/mutations/createUpdatableProxy.js#L211-L247","documentation":"After reading `__id` from an assigned item, Relay looks up that data ID in the record source proxy backing the updater. This error fires when the id exists on the item but no record with that id is present in the store, so the linked record cannot be set.","triggerScenarios":"Passing an item whose `__id` refers to a record that was never written to the store (e.g. an id from another RecordSource, an optimistic record not yet committed, or a garbage-collected record).","commonSituations":"Optimistic updaters referencing records created only after server response; records removed by an earlier updater or GC; ids from a disconnected store/normalized cache.","solutions":["Ensure the record exists before assigning: create it via `store.get(id)` / `store.create(id, typeName)` in the same updater","Verify you are reading ids from the same store/source the updater operates on","Check that another handler isn't deleting or GC-ing the record before this updater runs","Log the missing id and search the store (`store.get(id)`) to see why it is absent"],"exampleFix":"// before\nupdatable.viewer.friends.set([externalRecord]); // id not in this store\n// after\nconst rec = store.get(externalRecord.__id) ?? store.create(externalRecord.__id, 'User');\nupdatable.viewer.friends.set([rec]);","handlingStrategy":"validation","validationCode":"function requireRecord(store, id) {\n  const rec = store.get(id);\n  if (rec == null) throw new Error(`Record ${id} not in store before assignment`);\n  return rec;\n}","typeGuard":null,"tryCatchPattern":"try {\n  field.set(items);\n} catch (e) {\n  if (e.message.includes('Did not find item with data id')) {\n    const id = /data id (.+?) in/.exec(e.message)?.[1];\n    field.set(items.map(i => store.get(i.__id) ?? store.create(i.__id, 'Node')));\n  } else throw e;\n}","preventionTips":["Create records with store.create(id, type) before linking them in optimistic updaters","Ensure ids come from the same RecordSource the updater operates on","Watch for handlers/GC deleting records before your updater runs","Log missing ids in development to trace their origin"],"tags":["relay","updater","store","data-id"],"backgroundTag":"record-not-found-in-store","analyzedSha":"668b1b85e06261aa3b58dabfc51f8b5524a70955","analyzedAt":"2026-09-02T19:57:20.783Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}