{"record":{"id":"8d5db2c8e8fabacf","repo":"affaan-m/ECC","slug":"work-item-not-found-id-8d5db2","errorCode":null,"errorMessage":"Work item not found: ${id}","messagePattern":"Work item not found: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/work-items.js","lineNumber":442,"sourceCode":"\n    if (options.command === 'list') {\n      const payload = store.listWorkItems({ limit: normalizeLimit(options.limit) });\n      if (options.json) {\n        console.log(JSON.stringify(payload, null, 2));\n      } else {\n        printWorkItemList(payload);\n      }\n      return;\n    }\n\n    if (options.command === 'show') {\n      const id = resolveWorkItemId(options);\n      if (!id) {\n        throw new Error('Missing work item id.');\n      }\n      const item = store.getWorkItemById(id);\n      if (!item) {\n        throw new Error(`Work item not found: ${id}`);\n      }\n      if (options.json) {\n        console.log(JSON.stringify(item, null, 2));\n      } else {\n        printWorkItem(item);\n      }\n      return;\n    }\n\n    if (options.command === 'upsert') {\n      const id = resolveWorkItemId(options);\n      const existing = id ? store.getWorkItemById(id) : null;\n      const item = store.upsertWorkItem(buildUpsertPayload(options, existing));\n      if (options.json) {\n        console.log(JSON.stringify(item, null, 2));\n      } else {\n        printWorkItem(item);\n      }","sourceCodeStart":424,"sourceCodeEnd":460,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/work-items.js#L424-L460","documentation":"This error is thrown by the work-items CLI (scripts/work-items.js) when a user requests a specific work item by id (e.g. via the get/show subcommand) but the store has no work item with that id. resolveWorkItemId produced an id string, so the id format was acceptable, but store.getWorkItemById returned null. It is a straightforward lookup miss, not a validation failure.","triggerScenarios":"Running a lookup command (e.g. `node scripts/work-items.js get <id>` or show) where the id passed --id or as a positional resolves to a value that is not present in the work-items store. Happens after the item was deleted, the id was typo'd, or the store file is a different one than the item was written to.","commonSituations":"Developer typos an id or copies a truncated id from a branch name; item was already closed/deleted by another session; running the script from a different working directory so a different store file is read; stale docs referencing an old id.","solutions":["List all existing work items (the list command) and copy the exact id of the item you want.","Verify you are running the script from the same repository/working directory so it reads the intended store file.","Check the id for typos or truncation; ids are matched exactly by store.getWorkItemById.","If the item should exist but does not, re-create it with the create/upsert command, then look it up again."],"exampleFix":"// before\nnode scripts/work-items.js get 42\n// Error: Work item not found: 42\n\n// after\nnode scripts/work-items.js list          # find the real id\nnode scripts/work-items.js get wi-0042","handlingStrategy":"validation","validationCode":"const items = JSON.parse(execSync('node scripts/work-items.js list --json').toString());\nif (!items.some(i => i.id === id)) throw new Error(`id ${id} not in store; run list to see valid ids`);","typeGuard":null,"tryCatchPattern":"try {\n  execSync(`node scripts/work-items.js get ${id}`, { stdio: 'inherit' });\n} catch (e) {\n  if (String(e.stderr).includes('Work item not found')) {\n    console.error(`Item ${id} does not exist — run list first.`);\n  }\n}","preventionTips":["Always copy ids from the list command output rather than typing them from memory.","Run the script from the repository root so the same store file is read consistently.","Verify an id exists immediately after creating the item."],"tags":["cli","lookup-failed"],"backgroundTag":"record-not-found","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}