{"record":{"id":"99257eb54bb6fd93","repo":"sipeed/picoclaw","slug":"unsupported-observe-event-q","errorCode":null,"errorMessage":"unsupported observe event %q","messagePattern":"unsupported observe event %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/agent/hook_mount.go","lineNumber":301,"sourceCode":"\t}\n\treturn env\n}\n\nfunc processHookObserveKindsFromConfig(observe []string) ([]string, bool, error) {\n\tif len(observe) == 0 {\n\t\treturn nil, false, nil\n\t}\n\n\tvalidKinds := validHookEventKinds()\n\tnormalized := make([]string, 0, len(observe))\n\tfor _, kind := range observe {\n\t\tswitch kind {\n\t\tcase \"\", \"*\", \"all\":\n\t\t\treturn nil, true, nil\n\t\tdefault:\n\t\t\tnormalizedKind, ok := validKinds[kind]\n\t\t\tif !ok {\n\t\t\t\treturn nil, false, fmt.Errorf(\"unsupported observe event %q\", kind)\n\t\t\t}\n\t\t\tnormalized = append(normalized, normalizedKind)\n\t\t}\n\t}\n\n\tif len(normalized) == 0 {\n\t\treturn nil, false, nil\n\t}\n\treturn normalized, true, nil\n}\n\nfunc validHookEventKinds() map[string]string {\n\truntimeKinds := runtimeevents.KnownKinds()\n\tkinds := make(map[string]string, len(runtimeKinds)*2)\n\tfor _, kind := range runtimeKinds {\n\t\tkinds[kind.String()] = kind.String()\n\t}\n\tkinds[\"turn_start\"] = runtimeevents.KindAgentTurnStart.String()","sourceCodeStart":283,"sourceCodeEnd":319,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/agent/hook_mount.go#L283-L319","documentation":"Thrown by processHookObserveKindsFromConfig while normalizing a hook's `observe` list. Each entry must be \"*\"/\"all\" (wildcard, enables observing everything) or a known hook event kind from validHookEventKinds(): the runtime event kinds plus turn_start, turn_end, llm_request, llm_delta, llm_response, llm_retry, context_compress, session_summarize, tool_exec_start, tool_exec_end, tool_exec_skipped, steering_injected, follow_up_queued, interrupt_received, subturn_spawn, subturn_end, subturn_result_delivered, subturn_orphan, error.","triggerScenarios":"A hook config with observe: [\"turn-start\"] (hyphen instead of underscore), \"tool_call\", \"message\", or any event name not in the valid kinds map. Match is exact and case-sensitive; only \"\", \"*\", and \"all\" are special-cased.","commonSituations":"Guessing event names instead of checking the supported list; using provider/webhook event vocabulary; event kinds renamed or added between library versions so a previously valid kind stops resolving.","solutions":["Use a supported event kind exactly as spelled in validHookEventKinds (underscores, lowercase), e.g. llm_response, tool_exec_end","Use \"*\" or \"all\" if you want every event instead of listing names","If the value looks correct, check the library version — the kind may have been renamed; update to the current name"],"exampleFix":"# before\nhooks:\n  process:\n    my-hook:\n      command: [\"./hook\"]\n      observe: [\"turn-start\", \"tool_call\"]\n\n# after\nhooks:\n  process:\n    my-hook:\n      command: [\"./hook\"]\n      observe: [\"turn_start\", \"tool_exec_start\"]","handlingStrategy":"validation","validationCode":"func validateObserveKinds(observe []string) error {\n    valid := validHookEventKinds()\n    for _, k := range observe {\n        switch k {\n        case \"\", \"*\", \"all\":\n            continue\n        default:\n            if _, ok := valid[k]; !ok {\n                return fmt.Errorf(\"observe event %q unknown; use a known kind or \\\"*\\\"\", k)\n            }\n        }\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"opts, err := processHookOptionsFromConfig(spec)\nif err != nil {\n    return fmt.Errorf(\"hook %q observe config invalid: %w\", name, err)\n}","preventionTips":["Prefer observe: [\"*\"] unless you need filtering","Use underscores and lowercase event names (turn_start, not turn-start)","Re-validate observe lists after upgrading the library — event kinds evolve"],"tags":["config","hooks","events","validation","go"],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}