{"record":{"id":"fffafdae913633cd","repo":"langchain-ai/deepagents","slug":"unknown-external-event-kind-self-kind-r","errorCode":null,"errorMessage":"Unknown external event kind: {self.kind!r}","messagePattern":"Unknown external event kind: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/event_bus.py","lineNumber":75,"sourceCode":"    \"\"\"A transport-independent event delivered from outside the TUI.\"\"\"\n\n    kind: ExternalEventKind\n    payload: str\n    source: str\n    bypass: BypassTier = BypassTier.QUEUED\n    correlation_id: str | None = None\n\n    def __post_init__(self) -> None:\n        \"\"\"Validate invariants for direct construction.\n\n        Raises:\n            ValueError: If `kind` is not a known kind, the payload is empty\n                or whitespace-only, or the kind is `\"signal\"` but the payload\n                is not a recognized signal name.\n        \"\"\"\n        if self.kind not in _VALID_KINDS:\n            msg = f\"Unknown external event kind: {self.kind!r}\"\n            raise ValueError(msg)\n        if not self.payload or not self.payload.strip():\n            msg = \"External event payload must be a non-empty string\"\n            raise ValueError(msg)\n        if self.kind == \"signal\" and self.payload.strip().lower() not in _VALID_SIGNALS:\n            msg = (\n                f\"Unknown external signal: {self.payload!r}; \"\n                f\"expected one of {sorted(_VALID_SIGNALS)}\"\n            )\n            raise ValueError(msg)\n\n\nclass EventSource(Protocol):\n    \"\"\"Source of external events for the Textual app.\n\n    Implementations must be safe to `stop()` even when `start()` failed\n    partway through; the app always invokes `stop()` from a `finally` block.\n    \"\"\"\n","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/event_bus.py#L57-L93","documentation":"`ExternalEvent.__post_init__` validates each event against a fixed set of recognized kinds before it enters the event bus. A kind outside `_VALID_KINDS` is rejected with this ValueError so malformed events never reach the Textual app's event loop where they would be silently unhandled.","triggerScenarios":"Constructing `ExternalEvent(kind=\"...\", payload=\"...\")` with a kind string not in `_VALID_KINDS` — a typo, a custom kind invented by a producer, or a protocol change between producer and consumer versions.","commonSituations":"Hand-writing events emitted over the Unix socket; a producer plugin using a kind name from a different app version; renaming a kind on the producer side without updating the consumer.","solutions":["Use only kinds in `_VALID_KINDS` (see event_bus.py) for the exact allowed set.","Fix the kind spelling/casing on the producer side.","If a new kind is genuinely needed, add it to `_VALID_KINDS` plus handling logic — do not invent it at the call site.","Align producer and consumer to the same library version so kind vocabularies match."],"exampleFix":"// before\nExternalEvent(kind=\"notification\", payload=\"build done\")\n// after\nExternalEvent(kind=\"signal\", payload=\"reload\")","handlingStrategy":"validation","validationCode":"from deepagents_code.event_bus import ExternalEvent, _VALID_KINDS\n\ndef safe_event(kind: str, payload: str):\n    if kind not in _VALID_KINDS:\n        return None\n    return ExternalEvent(kind=kind, payload=payload)","typeGuard":"def is_valid_kind(kind: str) -> bool:\n    return kind in _VALID_KINDS","tryCatchPattern":"try:\n    event = ExternalEvent(kind=kind, payload=payload)\nexcept ValueError as exc:\n    logger.warning(\"Dropping invalid external event: %s\", exc)\n    event = None","preventionTips":["Centralize event construction in one producer module using only known kinds.","Keep producer and consumer library versions aligned.","Never invent kind strings at call sites; extend `_VALID_KINDS` deliberately."],"tags":["event-bus","validation","schema","input-error"],"backgroundTag":"unknown-event-kind","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}