{"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/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/work-items.js#L424-L460","documentation":"Thrown by the 'show' command when store.getWorkItemById(id) returns null, meaning no row in the SQLite state store matches the given local id. The id resolved fine (it is non-empty) but nothing was ever upserted under it. The id is interpolated into the message verbatim so typos are visible.","triggerScenarios":"Calling `show <id>` for an id that was never created, was created in a different --db database, or was mistyped. The store is created from options.dbPath or the default HOME-based location, so pointing at a different db yields 'not found' for items that exist elsewhere.","commonSituations":"Typos in the id; pointing at the wrong database (--db not set, or set to a stale path); the item was synced under a generated github-... id and you typed a human-readable name instead; the item was closed pruned.","solutions":["List first to confirm the exact id: `node scripts/work-items.js list` (or --json to grep).","Check you are using the same --db path where the item was created.","For GitHub items, the id has the form github-<owner-name-repo>-<pr|issue>-<number>; copy it from list output."],"exampleFix":"// before\nnode scripts/work-items.js show \"Refactor state store\"\n\n// after\nnode scripts/work-items.js list --json\n# find the real id, then:\nnode scripts/work-items.js show refactor-state-store","handlingStrategy":"try-catch","validationCode":"function showOrError(store, id) {\n  const item = store.getWorkItemById(id);\n  if (!item) return { ok: false, error: `Work item not found: ${id}` };\n  return { ok: true, item };\n}","typeGuard":"function isStoredWorkItem(value) {\n  return Boolean(value && typeof value === 'object' && typeof value.id === 'string' && typeof value.title === 'string');\n}","tryCatchPattern":"try {\n  // show flow\n} catch (error) {\n  if (/^Work item not found:/.test(error.message)) {\n    // recover: list items, suggest closest id, or exit gracefully\n  } else {\n    throw error;\n  }\n}","preventionTips":["Run list before show to confirm the exact id.","Confirm you are pointing at the same --db where the item was created.","For GitHub items, copy the generated github-... id from list output."],"tags":["cli","not-found","show","identifier","sqlite"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}