{"record":{"id":"1f2b52597bb2b94b","repo":"affaan-m/ECC","slug":"missing-work-item-id","errorCode":null,"errorMessage":"Missing work item id.","messagePattern":"Missing work item id\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/work-items.js","lineNumber":438,"sourceCode":"    store = await createStateStore({\n      dbPath: options.dbPath,\n      homeDir: process.env.HOME || os.homedir()\n    });\n\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) {","sourceCodeStart":420,"sourceCodeEnd":456,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/work-items.js#L420-L456","documentation":"Thrown by the 'show' command branch when resolveWorkItemId(options) returns null. Show fetches a single item by id from the SQLite store, so it cannot operate without one. Unlike the upsert message (481), this one is terse ('Missing work item id.') because show has no --id-or-title alternative to recommend.","triggerScenarios":"Running `node scripts/work-items.js show` with no positional id and no --id flag. Passing the id via an unsupported flag (e.g. --source-id) does not count, since resolveWorkItemId only reads options.id and options.positionals[0].","commonSituations":"Running show with no arguments; assuming --source-id or --url identifies the item; copy-paste that drops the trailing id.","solutions":["Pass the id positionally: `node scripts/work-items.js show my-item`.","Or use --id: `node scripts/work-items.js show --id my-item`.","If you only know the source id, first run `list` to find the local id."],"exampleFix":"// before\nnode scripts/work-items.js show\n\n// after\nnode scripts/work-items.js show refactor-state-store","handlingStrategy":"validation","validationCode":"function ensureShowId(options) {\n  const id = options.id || (options.positionals && options.positionals[0]);\n  if (!id) throw new Error('show needs <id> or --id <id>');\n  return id;\n}","typeGuard":"function hasWorkItemId(options) {\n  return Boolean(options && (options.id || (options.positionals && options.positionals[0])));\n}","tryCatchPattern":null,"preventionTips":["Always pass the id positionally or via --id for show.","If you only know a source id, run list first to find the local id.","Validate the id is non-empty before invoking show in scripts."],"tags":["cli","validation","missing-argument","show","identifier"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}