{"record":{"id":"90fa5cd62c69a390","repo":"langchain-ai/deepagents","slug":"unsupported-hook-event-event","errorCode":null,"errorMessage":"Unsupported hook event: {event}","messagePattern":"Unsupported hook event: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/hooks/reducer.py","lineNumber":547,"sourceCode":"            feedback=state.feedback,\n            context=state.context,\n            **common,\n        )\n    if event is HookEvent.PRE_COMPACT:\n        return PreCompactDecision(event=event, **common)\n    if event is HookEvent.STOP:\n        return StopDecision(\n            event=event,\n            continue_loop=state.continue_loop,\n            feedback=state.feedback,\n            **common,\n        )\n    if event is HookEvent.SUBAGENT_START:\n        return SubagentStartDecision(event=event, context=state.context, **common)\n    if event is HookEvent.SUBAGENT_STOP:\n        return SubagentStopDecision(event=event, context=state.context, **common)\n    msg = f\"Unsupported hook event: {event}\"\n    raise ValueError(msg)\n\n\ndef _append(values: list[str], value: str | None) -> None:\n    if value is not None:\n        values.append(value)\n\n\ndef _loop_guard_diagnostic() -> HookDiagnostic:\n    return HookDiagnostic(\n        code=\"continuation_guard\",\n        severity=\"warning\",\n        message=\"Ignored recursive stop-hook continuation\",\n    )\n","sourceCodeStart":529,"sourceCodeEnd":561,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/hooks/reducer.py#L529-L561","documentation":"`_decision` converts the accumulated reduction state into the final typed decision object for the hook event. Its exhaustive branch table covers each `HookEvent` member; if an event falls through, it raises `ValueError`, meaning an event kind reached the reducer that has no decision mapping.","triggerScenarios":"Calling `reduce_hook_results` (via `_decision`) with a `HookEvent` not handled by the branch table — a newly added enum member, a custom event kind, or code paths constructing HookEvent values outside the supported set.","commonSituations":"Library version skew where an event enum was extended without updating `_decision`; tests feeding synthetic HookEvent values into the reducer; forwarding raw event names from external config into the reducer.","solutions":["Reduce only supported HookEvent values; map/filter unknown events before calling `reduce_hook_results`","Add a branch in `_decision` returning the appropriate decision object if the event is a legitimate new kind","Align package versions so enum and reducer come from the same release"],"exampleFix":"// before\nreduce_hook_results(results, HookEvent(\"PreToolUseX\"))\n// after\nif event in SUPPORTED_EVENTS:\n    reduce_hook_results(results, event)","handlingStrategy":"validation","validationCode":"SUPPORTED_EVENTS = set(HookEvent)\nif event not in SUPPORTED_EVENTS:\n    raise ValueError(f\"event not reducible: {event}\")","typeGuard":null,"tryCatchPattern":"try:\n    decision = reduce_hook_results(results, event)\nexcept ValueError as e:\n    logger.warning(\"unsupported hook event in reducer: %s\", e)","preventionTips":["Only feed HookEvent values from the current library release into the reducer","Update `_decision` when HookEvent gains new members","Pin all hook-related packages to the same version"],"tags":["valueerror","hooks","reducer","internal-invariant"],"backgroundTag":"unsupported-event-type","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}