affaan-m/ECC · error · Error
Unknown command: ${options.command}
Error message
Unknown command: ${options.command} What it means
Thrown at the end of the command dispatch chain when options.command is not one of list, show, upsert, close, claim, or sync-github. parseArgs treats the first non-dash argv token as the command, so any typo or stray word becomes an unknown command rather than a silent default to list.
Source
Thrown at scripts/work-items.js:514
console.log('No unassigned open work items to claim.');
} else {
console.log(`Claimed by ${result.item.owner}:`);
printWorkItem(result.item);
}
return;
}
if (options.command === 'sync-github') {
const payload = syncGithubWorkItems(store, options);
if (options.json) {
console.log(JSON.stringify(payload, null, 2));
} else {
printGithubSyncResult(payload);
}
return;
}
throw new Error(`Unknown command: ${options.command}`);
} catch (error) {
console.error(`Error: ${error.message}`);
process.exit(1);
} finally {
if (store) {
store.close();
}
}
}
if (require.main === module) {
main();
}
module.exports = {
buildUpsertPayload,
buildGithubIssueWorkItem,
buildGithubPrWorkItem,View on GitHub (pinned to 01e15490f0)
Solutions
- Run `node scripts/work-items.js --help` to see the supported commands.
- Correct the command word: list, show, upsert, close, claim, sync-github.
- Make sure no leading positional (e.g. an env var expansion) is being consumed as the command.
Example fix
// before node scripts/work-items.js clsoe refactor-state-store // after node scripts/work-items.js close refactor-state-store
Defensive patterns
Strategy: validation
Validate before calling
const WORK_ITEM_COMMANDS = new Set(['list', 'show', 'upsert', 'close', 'claim', 'sync-github']);
function ensureKnownCommand(cmd) {
if (!WORK_ITEM_COMMANDS.has(cmd)) {
throw new Error(`Unknown command: ${cmd}. Valid: ${[...WORK_ITEM_COMMANDS].join(', ')}`);
}
return cmd;
} Type guard
function isWorkItemCommand(cmd) {
return typeof cmd === 'string'
&& ['list', 'show', 'upsert', 'close', 'claim', 'sync-github'].includes(cmd);
} Prevention
- Validate the command word against the known set before dispatching.
- Run --help to discover supported commands.
- Make sure no stray positional is being consumed as the command token.
When it happens
Trigger: Typing a subcommand wrong: `node scripts/work-items.js clsoe <id>`, `node scripts/work-items.js upsertt ...`, or passing a flag-like positional. The default command is 'list', so running the script with no command word does not hit this.
Common situations: Typos; using an old command name after a rename; shell alias inserting an extra token that becomes the command; copy-paste from docs that use a placeholder like `<command>`.
Related errors
- ${label} must be a positive integer
- Unknown install target: ${parsed.target}. Expected one of ${
- Consult requires a natural language query, for example: secu
- Invalid ${flagName}: ${value}
- Invalid format: ${parsed.format}. Use text, json, or markdow
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/97ef12a4a6b9f4af.
Report an issue: GitHub.