{"record":{"id":"dd871b5909020a59","repo":"affaan-m/ECC","slug":"invalid-hooks-value-options-hooks","errorCode":null,"errorMessage":"Invalid --hooks value: ${options.hooks}","messagePattern":"Invalid --hooks value: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/setup.js","lineNumber":110,"sourceCode":"    } else if (argument === '--move-scope') {\n      options.moveScope = true;\n    } else if (argument === '--json') {\n      options.json = true;\n    } else if (argument === '--help' || argument === '-h') {\n      options.help = true;\n    } else {\n      throw new Error(`Unknown argument: ${argument}`);\n    }\n  }\n\n  if (options.mode !== undefined && options.mode !== MODE) {\n    throw new Error(`Invalid setup mode: ${options.mode}. This command currently supports ${MODE}.`);\n  }\n  if (options.scope !== undefined && !VALID_SCOPES.has(options.scope)) {\n    throw new Error(`Invalid --scope value: ${options.scope}`);\n  }\n  if (options.hooks !== undefined && !VALID_HOOK_MODES.has(options.hooks)) {\n    throw new Error(`Invalid --hooks value: ${options.hooks}`);\n  }\n  if (options.moveScope && options.scope === undefined) {\n    throw new Error('--move-scope requires an explicit --scope destination.');\n  }\n  return options;\n}\n\nfunction questionWithCancellation(terminal, prompt) {\n  return new Promise((resolve, reject) => {\n    let settled = false;\n    const finish = callback => value => {\n      if (settled) return;\n      settled = true;\n      terminal.removeListener('close', onClose);\n      callback(value);\n    };\n    const onClose = finish(() => {\n      const error = new Error('Readline was closed before an answer was received.');","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/setup.js#L92-L128","documentation":"parseArgs validates --hooks against VALID_HOOK_MODES (off, minimal, standard, strict per the help) and throws this for any other value. The hook preference is persisted to Claude user settings, so only the predefined profiles are permitted.","triggerScenarios":"Running `ecc setup --hooks none`, `ecc setup --hooks all`, `ecc setup --hooks STRICT`, or any value outside off|minimal|standard|strict.","commonSituations":"Guessing profile names ('none' instead of 'off', 'full' instead of 'strict'); case errors; stale documentation referencing renamed hook profiles; CI scripts with a hardcoded invalid preference.","solutions":["Use one of: --hooks off, --hooks minimal, --hooks standard, or --hooks strict.","Omit --hooks to keep the current preference.","Confirm valid values in `ecc setup --help` under 'Hook preferences'."],"exampleFix":"// before\nnpm run setup -- --hooks none\n\n// after\nnpm run setup -- --hooks off","handlingStrategy":"validation","validationCode":"const VALID_HOOK_MODES = new Set(['off', 'minimal', 'standard', 'strict']);\nif (hooksArg !== undefined && !VALID_HOOK_MODES.has(hooksArg)) {\n  throw new Error(`Invalid --hooks value: ${hooksArg}`);\n}","typeGuard":"const isValidHookMode = (v) => ['off', 'minimal', 'standard', 'strict'].includes(v);","tryCatchPattern":"try {\n  await runSetup(rawArgs);\n} catch (err) {\n  if (/^Invalid --hooks value: /.test(err.message)) {\n    console.error(`${err.message}. Use one of: off, minimal, standard, strict.`);\n    process.exitCode = 2;\n  } else throw err;\n}","preventionTips":["Use the exact profile names off|minimal|standard|strict, not synonyms.","Centralize the hook preference in one config value reused by all scripts.","Check `ecc setup --help` when upgrading in case profiles changed."],"tags":["cli","enum","hooks"],"backgroundTag":"invalid-enum-value","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}