langchain-ai/deepagents · error · ValueError

Unsupported notification type: {value}

Error message

Unsupported notification type: {value}

What it means

`to_wire_notification_type` maps internal notification type values to their wire-format names expected by external hook consumers. An unmapped `value` raises `ValueError`, meaning a notification type reached the projection/matching layer that the wire schema does not define.

Source

Thrown at libs/code/deepagents_code/hooks/projection.py:408

    Raises:
        ValueError: If the notification type is unsupported.
    """
    mappings: dict[str, WireNotificationType] = {
        DcodeNotificationKind.PERMISSION_REQUIRED: (
            WireNotificationType.PERMISSION_PROMPT
        ),
        WireNotificationType.PERMISSION_PROMPT: WireNotificationType.PERMISSION_PROMPT,
        DcodeNotificationKind.AGENT_NEEDS_INPUT: WireNotificationType.AGENT_NEEDS_INPUT,
        DcodeNotificationKind.AGENT_COMPLETED: WireNotificationType.AGENT_COMPLETED,
        DcodeNotificationKind.COLD_CACHE_WARNING: (
            WireNotificationType.COLD_CACHE_WARNING
        ),
    }
    try:
        return mappings[value]
    except KeyError as exc:
        msg = f"Unsupported notification type: {value}"
        raise ValueError(msg) from exc

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Use one of the supported notification type values from the mappings table (import the enum/constant rather than hard-coding strings)
  2. Register the new type in `to_wire_notification_type`'s mappings if it is a legitimately new type
  3. Check for typos and version alignment between the producer of the event and the hook library

Example fix

// before
match_target(hook, "permission_reqest")
// after
from deepagents_code.hooks import NotificationType
match_target(hook, NotificationType.PERMISSION_REQUEST)
Defensive patterns

Strategy: validation

Validate before calling

from deepagents_code.hooks.projection import to_wire_notification_type
try:
    to_wire_notification_type(value)
except ValueError:
    raise ValueError(f"unsupported notification type: {value!r}")

Try / catch

try:
    wire_type = to_wire_notification_type(value)
except ValueError as e:
    logger.error("bad notification type in hook target: %s", e)
    raise

Prevention

When it happens

Trigger: Projecting a notification or matching a hook target whose `notification_type` is not one of the keys in the `mappings` table — e.g. a new or custom notification type, a typo, or a value added in a newer library version.

Common situations: Configuring hook matchers with a hand-written notification type string that differs from the supported enum; version mismatch between code producing events and the hook projection schema; typos like `"permisson_request"`.

Related errors


AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29). Data as JSON: /api/errors/21a24e2996033e70. Report an issue: GitHub.