affaan-m/ECC · error · Error
Invalid --hooks value: ${options.hooks}
Error message
Invalid --hooks value: ${options.hooks} What it means
Thrown by setup.js when --hooks is provided but is not in VALID_HOOK_MODES ({off, minimal, standard, strict}). The hook mode selects which automated hook profile is installed, so an unrecognized mode is rejected rather than silently installing no hooks.
Source
Thrown at scripts/setup.js:110
} else if (argument === '--move-scope') {
options.moveScope = true;
} else if (argument === '--json') {
options.json = true;
} else if (argument === '--help' || argument === '-h') {
options.help = true;
} else {
throw new Error(`Unknown argument: ${argument}`);
}
}
if (options.mode !== undefined && options.mode !== MODE) {
throw new Error(`Invalid setup mode: ${options.mode}. This command currently supports ${MODE}.`);
}
if (options.scope !== undefined && !VALID_SCOPES.has(options.scope)) {
throw new Error(`Invalid --scope value: ${options.scope}`);
}
if (options.hooks !== undefined && !VALID_HOOK_MODES.has(options.hooks)) {
throw new Error(`Invalid --hooks value: ${options.hooks}`);
}
if (options.moveScope && options.scope === undefined) {
throw new Error('--move-scope requires an explicit --scope destination.');
}
return options;
}
function questionWithCancellation(terminal, prompt) {
return new Promise((resolve, reject) => {
let settled = false;
const finish = callback => value => {
if (settled) return;
settled = true;
terminal.removeListener('close', onClose);
callback(value);
};
const onClose = finish(() => {
const error = new Error('Readline was closed before an answer was received.');View on GitHub (pinned to 01e15490f0)
Solutions
- Use one of: off, minimal, standard, or strict.
- Use `off` to disable hooks, `strict` for the most aggressive profile.
- Omit --hooks to choose interactively.
Example fix
# before node scripts/setup.js --hooks all --yes # after node scripts/setup.js --hooks strict --yes
Defensive patterns
Strategy: validation
Validate before calling
const HOOK_MODES = new Set(['off', 'minimal', 'standard', 'strict']);
const hooks = (process.argv.find(a => a.startsWith('--hooks')) || '').split('=')[1];
if (hooks !== undefined && !HOOK_MODES.has(hooks)) { console.error(`Invalid hooks mode: ${hooks}`); process.exit(2); } Type guard
function isValidHookMode(v) { return ['off','minimal','standard','strict'].includes(v); } Try / catch
try { parseArgs(process.argv); } catch (err) { console.error(err.message); process.exit(2); } Prevention
- Publish the hook-mode set in --help text and shell completion.
- Default to a documented mode rather than letting users guess names.
When it happens
Trigger: Passing `--hooks all`, `--hooks default`, `--hooks none`, or any value outside off/minimal/standard/strict.
Common situations: Expecting an 'all' or 'none' alias; typos like `--hooks standart`; carrying over hook names from a previous ECC version.
Related errors
- Missing value for ${argument}
- Unknown argument: ${argument}
- Invalid setup mode: ${options.mode}. This command currently
- Invalid --scope value: ${options.scope}
- --move-scope requires an explicit --scope destination.
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/dd871b5909020a59.
Report an issue: GitHub.