affaan-m/ECC · error · Error

Invalid lane ' '. Expected one of .

Error message

Invalid lane '${lane}'. Expected one of ${[...VALID_LANES].join(', ')}.

What it means

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.

Solutions

  1. Use exactly one of: ready, running, blocked, done (case-insensitive).
  2. Check the error message — it lists the current valid lanes.
  3. Add a mapping table if source lanes come from another system (e.g. 'in review' → 'running').
  4. Trim whitespace from user/CLI-supplied lane names before calling.

Example fix

// before
moveWorkItem(store, { id: 'item-42', lane: 'complete' });
// after
moveWorkItem(store, { id: 'item-42', lane: 'done' });
Defensive patterns

Strategy: validation

Validate before calling

const LANES = ['ready', 'running', 'blocked', 'done'];
const key = String(lane || '').trim().toLowerCase();
if (!LANES.includes(key)) throw new Error(`Bad lane ${lane}; use ${LANES.join('|')}`);

Type guard

function isValidLane(l) { return ['ready', 'running', 'blocked', 'done'].includes(String(l || '').trim().toLowerCase()); }

Try / catch

try { moveWorkItem(store, { id, lane }); } catch (e) {
  if (e.message.startsWith('Invalid lane')) console.error('Lane mapping needed:', e.message);
  else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: Translating an external board's column names directly to lanes without mapping; typos ('runnning'); older scripts using lane names from a previous schema version.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/e6b52396ef7d13b0. Report an issue: GitHub.

Appendix: source

Thrown at scripts/lib/control-pane/work-item-mutations.js:97

    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 };
}

module.exports = {
  DONE_STATUSES,
  LANE_TO_STATUS,
  VALID_LANES,
  VALID_ASSIGNEE_KINDS,

View on GitHub (pinned to 8321021c54)