deepseek-ai/deepseek-harness · error · SdkProtocolError

turn/end event requires a string data.reason.kind

Error message

turn/end event requires a string data.reason.kind

What it means

Error "turn/end event requires a string data.reason.kind" thrown in deepseek-ai/deepseek-harness.

Source

Thrown at python/sdk/src/deepseek_harness/api.py:240

    return ""


def finish_reason(events: list[JsonObject]) -> str | None:
    """Return the last turn-ending kind.

    The input must contain root-session events from one owned run interval.

    Raises:
        SdkProtocolError: The last ``turn/end`` has no string reason kind.
    """
    for event in reversed(events):
        if event.get("type") != "turn/end":
            continue
        data = event.get("data")
        reason = data.get("reason") if isinstance(data, dict) else None
        kind = reason.get("kind") if isinstance(reason, dict) else None
        if not isinstance(kind, str):
            raise SdkProtocolError("turn/end event requires a string data.reason.kind")
        return kind
    return None

View on GitHub (pinned to b150a551b8)

Solutions

  1. Ensure turn/end events carry a string data.reason.kind; fix the producer of the malformed event.

When it happens

Trigger: Thrown at python/sdk/src/deepseek_harness/api.py:240 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24). Data as JSON: /api/errors/6d101635aa48abb3. Report an issue: GitHub.