{"record":{"id":"20ecfcfe0b4e7677","repo":"affaan-m/ECC","slug":"invalid-managed-hook-handler-at-label-unsupported-type","errorCode":null,"errorMessage":"Invalid managed hook handler at ${label}: unsupported type","messagePattern":"Invalid managed hook handler at (.+?): unsupported type","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/lib/install/claude-settings.js","lineNumber":76,"sourceCode":"function assertClaudeSettingsPath(destinationPath, trustedRoot) {\n  const resolvedDestination = path.resolve(destinationPath);\n  const resolvedExpected = path.resolve(getClaudeSettingsPath(trustedRoot));\n  const pathsMatch = process.platform === 'win32'\n    ? resolvedDestination.toLowerCase() === resolvedExpected.toLowerCase()\n    : resolvedDestination === resolvedExpected;\n  if (!pathsMatch) {\n    throw new Error(\n      `Refusing to manage Claude hooks outside the canonical settings file: ${destinationPath}`\n    );\n  }\n}\n\nfunction validateHookHandler(hook, label) {\n  if (!isJsonObject(hook)) {\n    throw new Error(`Invalid managed hook handler at ${label}: expected a JSON object`);\n  }\n  if (!VALID_HOOK_TYPES.has(hook.type)) {\n    throw new Error(`Invalid managed hook handler at ${label}: unsupported type`);\n  }\n  if (hook.timeout !== undefined && (typeof hook.timeout !== 'number' || hook.timeout < 0)) {\n    throw new Error(`Invalid managed hook handler at ${label}: invalid timeout`);\n  }\n\n  if (hook.type === 'command') {\n    const validCommand = isNonEmptyString(hook.command)\n      || (Array.isArray(hook.command)\n        && hook.command.length > 0\n        && hook.command.every(isNonEmptyString));\n    if (!validCommand) {\n      throw new Error(`Invalid managed hook handler at ${label}: invalid command`);\n    }\n    if (hook.async !== undefined && typeof hook.async !== 'boolean') {\n      throw new Error(`Invalid managed hook handler at ${label}: invalid async flag`);\n    }\n    return;\n  }","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/install/claude-settings.js#L58-L94","documentation":"validateHookHandler requires each handler's 'type' field to be one of the VALID_HOOK_TYPES supported by ECC's managed hooks. An object handler with a missing or unrecognized type (e.g. 'script', 'shell', or undefined) is rejected so the installer never writes hook entries Claude cannot interpret.","triggerScenarios":"validateManagedHooks processes a handler object whose hook.type is not in VALID_HOOK_TYPES — missing type field, typo'd type, or a type from a newer/older Claude hooks schema.","commonSituations":"Copying hook examples from docs for other tools that use different type names; editing type by hand; schema drift after a Claude Code hooks format change.","solutions":["Set the handler's 'type' to a supported value (e.g. \"command\") at the labeled location.","Check VALID_HOOK_TYPES in scripts/lib/install/claude-settings.js for the exact accepted set.","Update ECC if your hooks schema is newer than the installed version's validator."],"exampleFix":"// before\n{ \"type\": \"shell\", \"command\": \"node my-hook.js\" }\n// after\n{ \"type\": \"command\", \"command\": \"node my-hook.js\" }","handlingStrategy":"validation","validationCode":"import { VALID_HOOK_TYPES } from './scripts/lib/install/claude-settings.js';\nfor (const handlers of Object.values(settings.hooks ?? {})) {\n  for (const h of handlers) {\n    if (!VALID_HOOK_TYPES.has(h.type)) throw new Error(`unsupported hook type: ${h.type}`);\n  }\n}","typeGuard":"const hasValidHookType = (h, valid) => typeof h?.type === 'string' && valid.has(h.type);","tryCatchPattern":"try {\n  validateManagedHooks(hooks);\n} catch (e) {\n  if (e.message.includes('unsupported type')) {\n    console.error('Use one of:', [...VALID_HOOK_TYPES].join(', '));\n  } else throw e;\n}","preventionTips":["Check VALID_HOOK_TYPES in scripts/lib/install/claude-settings.js before authoring handlers.","Keep ECC updated if the Claude hooks schema changed upstream.","Don't invent hook types; only \"command\"-style types supported by the validator."],"tags":["hooks","validation","enum","schema"],"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"}