affaan-m/ECC · error · Error
Unknown catalog command
Error message
Unknown catalog command: ${options.command} What it means
main() is the final dispatcher for catalog subcommands (help, list, show, etc.). If options.command holds a value none of the branches handle, it throws `Unknown catalog command: ${options.command}`; the catch block prints 'Error: ...' to stderr and exits with status 1.
Solutions
- Run `node scripts/catalog.js --help` to list valid commands and correct the typo
- Check for extra tokens shifting argv positions (a stray flag before the command)
- Update automation scripts to the current command names
- If programmatically calling main, only pass documented commands
Example fix
// before node scripts/catalog.js instal // Error: Unknown catalog command: instal // after node scripts/catalog.js list
Defensive patterns
Strategy: validation
Validate before calling
const VALID_COMMANDS = ['list','show'];
const cmd = process.argv[2];
if (!VALID_COMMANDS.includes(cmd)) {
console.error(`Unknown command '${cmd}'. Valid: ${VALID_COMMANDS.join(', ')}`);
process.exit(2);
} Try / catch
try {
main();
} catch (err) {
if (err.message.startsWith('Unknown catalog command')) {
console.error(`${err.message}. Run 'catalog --help'.`);
process.exit(1);
}
throw err;
} Prevention
- Copy commands from --help rather than memory
- Keep a single source of truth for command names in team docs
- Watch for argv shifts from stray leading flags
- Update automation when commands are renamed
When it happens
Trigger: Passing an unrecognized subcommand as argv[2] (e.g. `catalog instal` or an unsupported `catalog search`), or calling main programmatically with options.command set to an unexpected string.
Common situations: Typos in subcommands; outdated documentation referencing removed commands; shell aliases prefixing an extra token so the wrong word lands in the command slot; CI scripts renamed commands across versions.
Understand the failure class
Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.
Related errors
- Unknown command
- Unsupported Itô command
- Agents directory not found
- --all-harnesses and --harness are mutually exclusive.
- all overlays must be readable local files
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/7c95c6b372379031.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/catalog.js:179
printComponents(components);
}
return;
}
if (options.command === 'show') {
if (!options.componentId) {
throw new Error('Catalog show requires an install component ID');
}
const component = getInstallComponent(options.componentId);
if (options.json) {
console.log(JSON.stringify(component, null, 2));
} else {
printComponent(component);
}
return;
}
throw new Error(`Unknown catalog command: ${options.command}`);
} catch (error) {
console.error(`Error: ${error.message}`);
process.exit(1);
}
}
main();
View on GitHub (pinned to 8321021c54)