{"record":{"id":"7f7d1c931bcb0390","repo":"sipeed/picoclaw","slug":"unsupported-intercept-q","errorCode":null,"errorMessage":"unsupported intercept %q","messagePattern":"unsupported intercept %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/agent/hook_mount.go","lineNumber":258,"sourceCode":"\tobserveKinds, observeEnabled, err := processHookObserveKindsFromConfig(spec.Observe)\n\tif err != nil {\n\t\treturn ProcessHookOptions{}, err\n\t}\n\topts.Observe = observeEnabled\n\topts.ObserveKinds = observeKinds\n\n\tfor _, intercept := range spec.Intercept {\n\t\tswitch intercept {\n\t\tcase \"before_llm\", \"after_llm\":\n\t\t\topts.InterceptLLM = true\n\t\tcase \"before_tool\", \"after_tool\":\n\t\t\topts.InterceptTool = true\n\t\tcase \"approve_tool\":\n\t\t\topts.ApproveTool = true\n\t\tcase \"\":\n\t\t\tcontinue\n\t\tdefault:\n\t\t\treturn ProcessHookOptions{}, fmt.Errorf(\"unsupported intercept %q\", intercept)\n\t\t}\n\t}\n\n\tif !opts.Observe && !opts.InterceptLLM && !opts.InterceptTool && !opts.ApproveTool {\n\t\treturn ProcessHookOptions{}, fmt.Errorf(\"no hook modes enabled\")\n\t}\n\n\treturn opts, nil\n}\n\nfunc processHookEnvFromMap(envMap map[string]string) []string {\n\tif len(envMap) == 0 {\n\t\treturn nil\n\t}\n\n\tkeys := make([]string, 0, len(envMap))\n\tfor key := range envMap {\n\t\tkeys = append(keys, key)","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/agent/hook_mount.go#L240-L276","documentation":"Thrown by processHookOptionsFromConfig (pkg/agent/hook_mount.go) while validating a process hook's `intercept` list from config.ProcessHookConfig. Every entry must be exactly one of the supported intercept names: before_llm, after_llm, before_tool, after_tool, approve_tool. Empty strings are skipped; anything else is rejected with the offending value echoed back.","triggerScenarios":"A process hook config entry whose intercept array contains a value like \"pre_llm\", \"Before_Tool\", \"on_tool\", or \"tool_approve\" — i.e. any string that is not byte-for-byte one of the five supported names. The error fires at hook-mount time, before any process is spawned.","commonSituations":"Typos or wrong casing in YAML/JSON hook config; copying event names from a different hook system (e.g. Claude Code hook names) into this config; a renamed intercept name after upgrading the library.","solutions":["Change the offending intercept value to one of: before_llm, after_llm, before_tool, after_tool, approve_tool (exact lowercase, underscores)","Check for casing mistakes — the match is case-sensitive, so \"Before_LLM\" fails","Remove the stale entry if it was valid in an older version and the hook no longer needs it"],"exampleFix":"# before (hooks config)\nhooks:\n  process:\n    my-hook:\n      enabled: true\n      command: [\"./hook\"]\n      intercept: [\"Before_LLM\", \"pre_tool\"]\n\n# after\nhooks:\n  process:\n    my-hook:\n      enabled: true\n      command: [\"./hook\"]\n      intercept: [\"before_llm\", \"before_tool\"]","handlingStrategy":"validation","validationCode":"var supportedIntercepts = map[string]bool{\n    \"before_llm\": true, \"after_llm\": true,\n    \"before_tool\": true, \"after_tool\": true,\n    \"approve_tool\": true,\n}\n\nfunc validateIntercepts(spec config.ProcessHookConfig) error {\n    for _, v := range spec.Intercept {\n        if v == \"\" {\n            continue\n        }\n        if !supportedIntercepts[v] {\n            return fmt.Errorf(\"intercept %q unsupported; want one of before_llm, after_llm, before_tool, after_tool, approve_tool\", v)\n        }\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"opts, err := processHookOptionsFromConfig(spec)\nif err != nil {\n    // config error: fail fast at startup with the offending value in the message\n    log.Fatalf(\"invalid hook config: %v\", err)\n}","preventionTips":["Validate hook config in CI or at startup before mounting hooks","Keep the supported intercept list next to your config templates","Add a config schema/linter so typos surface before runtime"],"tags":["config","hooks","validation","go"],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}