{"record":{"id":"5f8e826e1ecc2008","repo":"affaan-m/ECC","slug":"invalid-claude-hooks-preference-claudehooks","errorCode":null,"errorMessage":"Invalid Claude hooks preference: ${claudeHooks}","messagePattern":"Invalid Claude hooks preference: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/lib/multi-harness-setup.js","lineNumber":42,"sourceCode":"  }\n\n  const includesClaude = harnesses.includes('claude');\n  const includesKimi = harnesses.includes('kimi');\n  if (!includesClaude && (input.claudeScope !== undefined || input.claudeHooks !== undefined)) {\n    throw new Error('Claude scope and hook options require Claude to be selected.');\n  }\n  if (!includesKimi && input.profile !== undefined) {\n    throw new Error('The managed install profile requires Kimi to be selected.');\n  }\n\n  const claudeScope = includesClaude ? (input.claudeScope || 'user') : undefined;\n  const claudeHooks = includesClaude ? (input.claudeHooks || 'standard') : undefined;\n  const profile = includesKimi ? (input.profile || 'core') : undefined;\n  if (claudeScope && !VALID_CLAUDE_SCOPES.has(claudeScope)) {\n    throw new Error(`Invalid Claude scope: ${claudeScope}`);\n  }\n  if (claudeHooks && !VALID_CLAUDE_HOOKS.has(claudeHooks)) {\n    throw new Error(`Invalid Claude hooks preference: ${claudeHooks}`);\n  }\n  if (profile && !VALID_PROFILES.has(profile)) {\n    throw new Error(`Invalid Kimi install profile: ${profile}`);\n  }\n\n  return {\n    harnesses,\n    ...(claudeHooks ? { claudeHooks } : {}),\n    ...(claudeScope ? { claudeScope } : {}),\n    dryRun: Boolean(input.dryRun),\n    json: Boolean(input.json),\n    ...(profile ? { profile } : {}),\n    yes: Boolean(input.yes),\n  };\n}\n\nfunction canonicalPath(filePath) {\n  return realpathNearestExisting(filePath);","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/multi-harness-setup.js#L24-L60","documentation":"normalizeGuidedInstallRequest validates the resolved claudeHooks preference (defaulting to 'standard') against the VALID_CLAUDE_HOOKS whitelist. An unrecognized hooks preference string throws this error with the offending value. It protects against misspelled hook profiles that would otherwise be silently ignored or misapplied.","triggerScenarios":"Calling the guided install request API with input.claudeHooks set to a string not present in VALID_CLAUDE_HOOKS (e.g. 'strict-hooks', 'off', or a casing/typo variant of a valid value like 'standard'/'strict').","commonSituations":"Typo in CLI flag or script; copying a hooks level name from another project with different tiers; passing free-form strings from an interactive prompt without validating against the allowed set.","solutions":["Use one of the valid hooks preferences defined in VALID_CLAUDE_HOOKS (e.g. 'standard', 'strict')","Omit claudeHooks to fall back to the 'standard' default","Validate the value against VALID_CLAUDE_HOOKS before constructing the request"],"exampleFix":"// before\nrunSetup({ harnesses: ['claude'], claudeHooks: 'aggressive' })\n// after\nrunSetup({ harnesses: ['claude'], claudeHooks: 'strict' })","handlingStrategy":"validation","validationCode":"const VALID_HOOKS = ['standard', 'strict'] // confirm against VALID_CLAUDE_HOOKS in the library\nif (input.claudeHooks !== undefined && !VALID_HOOKS.includes(input.claudeHooks)) {\n  throw new Error(`claudeHooks must be one of: ${VALID_HOOKS.join(', ')}`)\n}","typeGuard":"const isValidHooksPref = (s) => typeof s === 'string' && ['standard', 'strict'].includes(s)","tryCatchPattern":"try {\n  return normalizeGuidedInstallRequest(input)\n} catch (err) {\n  if (err.message.startsWith('Invalid Claude hooks preference:')) {\n    return normalizeGuidedInstallRequest({ ...input, claudeHooks: 'standard' })\n  }\n  throw err\n}","preventionTips":["Restrict interactive prompts/CLI flags to the library's valid hooks values","Default to omitting claudeHooks so the 'standard' default applies","Check changelogs for hooks-tier renames after upgrading the library"],"tags":["validation","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"}