affaan-m/ECC · error · Error
move requires a work item id.
Error message
move requires a work item id.
What it means
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.
Source
Thrown at scripts/lib/control-pane/work-item-mutations.js:91
metadata.assigneeKind = kind;
}
const item = store.upsertWorkItem({
...target,
owner,
sessionId: sessionId ?? target.sessionId ?? null,
status: status ?? 'running',
metadata,
updatedAt: new Date().toISOString()
});
return { claimed: true, item };
}
/**
* Move a work item to a kanban lane (ready | running | blocked | done).
*/
function moveWorkItem(store, { id, lane } = {}) {
if (!id) {
throw new Error('move requires a work item id.');
}
const laneKey = String(lane || '')
.trim()
.toLowerCase();
if (!VALID_LANES.has(laneKey)) {
throw new Error(`Invalid lane '${lane}'. Expected one of ${[...VALID_LANES].join(', ')}.`);
}
const target = store.getWorkItemById(id);
if (!target) {
throw new Error(`Work item not found: ${id}`);
}
const item = store.upsertWorkItem({
...target,
status: LANE_TO_STATUS[laneKey],
updatedAt: new Date().toISOString()
});
return { moved: true, item };
}View on GitHub (pinned to 01e15490f0)
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.
Example fix
// before
moveWorkItem(store, { lane: targetLane }); // forgot id
// after — guard the precondition
if (!id) throw new Error('Select a card before moving it.');
moveWorkItem(store, { id, lane: targetLane }); Defensive patterns
Strategy: validation
Validate before calling
if (!id || (typeof id !== 'string' && typeof id !== 'number')) {
throw new Error('Move requires a work item id.');
} Type guard
function hasMoveId(id) {
return Boolean(id) && (typeof id === 'string' || typeof id === 'number');
} Try / catch
try {
moveWorkItem(store, { id, lane });
} catch (e) {
if (/requires a work item id/.test(e.message)) { selectCardFirst(); return; }
throw e;
} Prevention
- Disable move UI until a card is selected.
- Require --id in the CLI move command.
- Validate id presence at the call site.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- claim requires an owner.
- Invalid lane '${lane}'. Expected one of ${[...VALID_LANES].j
- Work item not found: ${id}
- assigneeKind must be 'agent' or 'human'.
- invalid repo: expected non-empty string, got ${JSON.stringif
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/5b4271f32d52dda9.
Report an issue: GitHub.