{"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/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/control-pane/work-item-mutations.js#L73-L109","documentation":"moveWorkItem in the control-pane store requires the id of the work item to move to a kanban lane (ready|running|blocked|done); thrown when the id property of the input object is falsy, before the lane is even validated.","triggerScenarios":"moveWorkItem(store, { lane: 'done' }) with id omitted, null, or empty string — UI button without bound id, CLI call missing the id argument, or destructuring a payload where the id key was named differently.","commonSituations":"Event handlers wiring drag-drop that lose the item id; scripts iterating a list where one record lacks id; CLI positional args off by one so id lands in lane or is dropped.","solutions":["Pass the work item id: moveWorkItem(store, { id, lane }).","Resolve the id via the store lookup before moving.","Fix callers that forward an unset id from CLI parsing."],"exampleFix":"// before\nmoveWorkItem(store, { lane: 'done' });\n// after\nmoveWorkItem(store, { id: 'item-42', lane: 'done' });","handlingStrategy":"validation","validationCode":"if (!id || typeof id !== 'string' || !id.trim()) {\n  throw new Error('moveWorkItem requires a non-empty id');\n}","typeGuard":"function hasId(args) { return typeof args?.id === 'string' && args.id.trim().length > 0; }","tryCatchPattern":"try { moveWorkItem(store, { id, lane }); } catch (e) {\n  if (e.message === 'move requires a work item id.') console.error('Missing id in move payload:', { id, lane });\n  else throw e;\n}","preventionTips":["Bind item ids explicitly in UI event handlers and verify at dev time.","Validate the mutation payload shape before calling.","Guard call sites: skip no-op moves when id is absent.","Log the full payload when a move fails to spot dropped fields."],"tags":["work-items","validation","missing-argument"],"backgroundTag":"missing-required-argument","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"}