{"record":{"id":"e6b52396ef7d13b0","repo":"affaan-m/ECC","slug":"invalid-lane-lane-expected-one-of-vali","errorCode":null,"errorMessage":"Invalid lane '${lane}'. Expected one of ${[...VALID_LANES].join(', ')}.","messagePattern":"Invalid lane '(.+?)'\\. Expected one of (.+?)\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/lib/control-pane/work-item-mutations.js","lineNumber":97,"sourceCode":"    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}\n\nmodule.exports = {\n  DONE_STATUSES,\n  LANE_TO_STATUS,\n  VALID_LANES,\n  VALID_ASSIGNEE_KINDS,","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/control-pane/work-item-mutations.js#L79-L115","documentation":"moveWorkItem validates the destination lane against the fixed set (ready | running | blocked | done). An unrecognized lane throws \"Invalid lane '<lane>'. Expected one of ...\" including the allowed values in the message.","triggerScenarios":"moveWorkItem(store, { id, lane: 'complete' }) — synonyms like 'complete'/'in-progress'/'todo' instead of the four canonical lanes; uppercase input is fine (lowercased) but wrong words are not.","commonSituations":"Translating an external board's column names directly to lanes without mapping; typos ('runnning'); older scripts using lane names from a previous schema version.","solutions":["Use exactly one of: ready, running, blocked, done (case-insensitive).","Check the error message — it lists the current valid lanes.","Add a mapping table if source lanes come from another system (e.g. 'in review' → 'running').","Trim whitespace from user/CLI-supplied lane names before calling."],"exampleFix":"// before\nmoveWorkItem(store, { id: 'item-42', lane: 'complete' });\n// after\nmoveWorkItem(store, { id: 'item-42', lane: 'done' });","handlingStrategy":"validation","validationCode":"const LANES = ['ready', 'running', 'blocked', 'done'];\nconst key = String(lane || '').trim().toLowerCase();\nif (!LANES.includes(key)) throw new Error(`Bad lane ${lane}; use ${LANES.join('|')}`);","typeGuard":"function isValidLane(l) { return ['ready', 'running', 'blocked', 'done'].includes(String(l || '').trim().toLowerCase()); }","tryCatchPattern":"try { moveWorkItem(store, { id, lane }); } catch (e) {\n  if (e.message.startsWith('Invalid lane')) console.error('Lane mapping needed:', e.message);\n  else throw e;\n}","preventionTips":["Maintain a mapping from external board column names to the four canonical lanes.","Keep lane names as shared constants, not inline strings.","Normalize (trim/lowercase) user- and CLI-supplied lane values.","Reuse the error message's list to stay current if lanes change."],"tags":["work-items","enum","validation"],"backgroundTag":"invalid-enum-value","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"}