{"record":{"id":"5b4271f32d52dda9","repo":"affaan-m/ECC","slug":"move-requires-a-work-item-id","errorCode":null,"errorMessage":"move requires a work item id.","messagePattern":"move requires a work item id\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/lib/control-pane/work-item-mutations.js","lineNumber":91,"sourceCode":"    metadata.assigneeKind = kind;\n  }\n  const item = store.upsertWorkItem({\n    ...target,\n    owner,\n    sessionId: sessionId ?? target.sessionId ?? null,\n    status: status ?? 'running',\n    metadata,\n    updatedAt: new Date().toISOString()\n  });\n  return { claimed: true, item };\n}\n\n/**\n * Move a work item to a kanban lane (ready | running | blocked | done).\n */\nfunction moveWorkItem(store, { id, lane } = {}) {\n  if (!id) {\n    throw new Error('move requires a work item id.');\n  }\n  const laneKey = String(lane || '')\n    .trim()\n    .toLowerCase();\n  if (!VALID_LANES.has(laneKey)) {\n    throw new Error(`Invalid lane '${lane}'. Expected one of ${[...VALID_LANES].join(', ')}.`);\n  }\n  const target = store.getWorkItemById(id);\n  if (!target) {\n    throw new Error(`Work item not found: ${id}`);\n  }\n  const item = store.upsertWorkItem({\n    ...target,\n    status: LANE_TO_STATUS[laneKey],\n    updatedAt: new Date().toISOString()\n  });\n  return { moved: true, item };\n}","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/lib/control-pane/work-item-mutations.js#L73-L109","documentation":"Thrown by moveWorkItem when the id argument is falsy. Moving a card to a lane requires knowing which card; without an id the store cannot target any item. This is a pure precondition failure in the caller — there is no item-state involvement, unlike the later 'not found' check.","triggerScenarios":"Calling moveWorkItem({ lane }) with no id; passing id: undefined from a UI handler that failed to read the selected card; a CLI move command missing the positional id argument.","commonSituations":"UI 'move' button clicked with no card selected; CLI flag parsing dropped the id; programmatic caller passed the whole event object instead of the id.","solutions":["Always pass a non-empty id string when calling moveWorkItem.","Disable or hide the move action in the UI until a card is selected.","Validate id at the call site and return early with a user-facing message.","Add a unit test asserting moveWorkItem throws on missing id."],"exampleFix":"// before\nmoveWorkItem(store, { lane: targetLane }); // forgot id\n\n// after — guard the precondition\nif (!id) throw new Error('Select a card before moving it.');\nmoveWorkItem(store, { id, lane: targetLane });","handlingStrategy":"validation","validationCode":"if (!id || (typeof id !== 'string' && typeof id !== 'number')) {\n  throw new Error('Move requires a work item id.');\n}","typeGuard":"function hasMoveId(id) {\n  return Boolean(id) && (typeof id === 'string' || typeof id === 'number');\n}","tryCatchPattern":"try {\n  moveWorkItem(store, { id, lane });\n} catch (e) {\n  if (/requires a work item id/.test(e.message)) { selectCardFirst(); return; }\n  throw e;\n}","preventionTips":["Disable move UI until a card is selected.","Require --id in the CLI move command.","Validate id presence at the call site."],"tags":["work-items","move","validation","precondition"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}