langchain-ai/deepagents · error · TypeError
Unsupported hook-specific output: {type(specific).__name__}
Error message
Unsupported hook-specific output: {type(specific).__name__} What it means
`_merge_specific` is a singledispatch function in `libs/code/deepagents_code/hooks/reducer.py` that folds handler-specific output (e.g. session-start context, decision fields) into the reduction state. The fallback raises `TypeError` when handed a `HookSpecificOutput` subtype with no registered merger, indicating output that the reducer cannot incorporate.
Source
Thrown at libs/code/deepagents_code/hooks/reducer.py:298
f"Ignored Stop continuation after {MAX_STOP_CONTINUATIONS} "
"consecutive attempts"
),
)
)
return
state.continue_loop = True
state.feedback.append(message)
@singledispatch
def _merge_specific(
specific: HookSpecificOutput,
_invocation: HookInvocation,
_state: _Reduction,
_handler_id: str,
) -> None:
msg = f"Unsupported hook-specific output: {type(specific).__name__}"
raise TypeError(msg)
@_merge_specific.register
def _merge_session_start(
specific: SessionStartSpecificOutput,
_invocation: HookInvocation,
state: _Reduction,
handler_id: str,
) -> None:
_append(state.context, specific.additional_context)
for attr, wire_name in _UNSUPPORTED_SESSION_START_FIELDS:
value = getattr(specific, attr)
if value not in (None, False, [], ""):
_diagnose_unsupported_field(state, handler_id, wire_name)
@_merge_specific.register
def _merge_user_prompt_submit(View on GitHub (pinned to a1af029e6e)
Solutions
- Return a supported HookSpecificOutput type (e.g. `SessionStartSpecificOutput`) from the handler
- Register a merger via `@_merge_specific.register` for the custom output type
- Update/align library versions so handler outputs and reducer registrations match
Example fix
// before class MyOutput(HookSpecificOutput): ... return MyOutput() // after return SessionStartSpecificOutput(...) # or register @_merge_specific.register for MyOutput
Defensive patterns
Strategy: type-guard
Validate before calling
if not isinstance(output, (SessionStartSpecificOutput,)): # supported types
raise TypeError(f"unsupported hook-specific output: {type(output).__name__}") Type guard
from typing import TypeGuard
def is_mergeable(o: HookSpecificOutput) -> TypeGuard[SessionStartSpecificOutput]:
return isinstance(o, SessionStartSpecificOutput) Try / catch
try:
decision = reduce_hook_results(results, event)
except TypeError as e:
logger.warning("dropping unmergeable hook output: %s", e) Prevention
- Return only HookSpecificOutput types the library defines
- Register a merger when adding a new output subtype
- Keep handler and reducer code versions in sync
When it happens
Trigger: A hook handler returns a `HookSpecificOutput` subclass that has no `@_merge_specific.register` handler — typically a custom output type, a mocked output in tests, or output from a newer library version not matched by the reducer table.
Common situations: Writing a custom hook handler that returns a hand-rolled HookSpecificOutput subclass; test doubles implementing the output protocol; version skew between hook handler code and the reducer.
Related errors
- Unsupported hook event: {type(event).__name__}
- Unsupported hook event: {event}
- Expected UserPromptSubmitDecision, got {type(decision).__nam
- Expected PreCompactDecision, got {type(decision).__name__}
- Expected PermissionRequestDecision, got {type(decision).__na
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/fe45545964e86adf.
Report an issue: GitHub.