bytedance/deer-flow · error · HonchoRequestError

Honcho returned non-JSON response: POST {path}: {exc}

Error message

Honcho returned non-JSON response: POST {path}: {exc}

What it means

After a successful POST (2xx with a body), the Honcho client tries response.json(); a ValueError from JSON parsing is re-raised as HonchoRequestError('non-JSON response'). This means the transport worked but the payload was not JSON — typically an HTML error page from a proxy, a misrouted gateway, or a text/plain response.

Source

Thrown at backend/packages/harness/deerflow/agents/memory/backends/honcho/client.py:48

            headers=headers,
            timeout=httpx.Timeout(config.timeout_seconds, connect=config.connect_timeout_seconds),
            transport=transport,
        )

    def close(self) -> None:
        self._http.close()

    def _post(self, path: str, payload: Any) -> Any:
        try:
            response = self._http.post(path, json=payload)
            response.raise_for_status()
        except httpx.HTTPError as exc:
            raise HonchoRequestError(f"Honcho request failed: POST {path}: {exc}") from exc
        if response.content:
            try:
                return response.json()
            except ValueError as exc:
                raise HonchoRequestError(f"Honcho returned non-JSON response: POST {path}: {exc}") from exc
        return None

    def get_or_create_peer(self, workspace: str, peer_id: str) -> None:
        self._post(f"/v3/workspaces/{workspace}/peers", {"id": peer_id})

    def get_or_create_session(self, workspace: str, session_id: str) -> None:
        self._post(f"/v3/workspaces/{workspace}/sessions", {"id": session_id})

    def set_session_peers(self, workspace: str, session_id: str, peer_ids: list[str]) -> None:
        self._post(f"/v3/workspaces/{workspace}/sessions/{session_id}/peers", {peer_id: {} for peer_id in peer_ids})

    def add_messages(self, workspace: str, session_id: str, messages: list[dict[str, str]]) -> None:
        self._post(f"/v3/workspaces/{workspace}/sessions/{session_id}/messages", {"messages": messages})

    def working_representation(self, workspace: str, peer_id: str, *, max_conclusions: int = 25) -> str:
        data = self._post(f"/v3/workspaces/{workspace}/peers/{peer_id}/representation", {"max_conclusions": max_conclusions})
        if isinstance(data, dict):
            return str(data.get("representation") or "")

View on GitHub (pinned to 1dd6ba1acb)

Solutions

  1. Correct the Honcho base URL to the API root (e.g. https://api.honcho.dev, not a proxy serving HTML)
  2. Reproduce manually: curl -X POST <base>/v3/workspaces/<ws>/peers -d '{"id":"p"}' -H 'Content-Type: application/json' and inspect the body
  3. Check Accept/Content-Type handling on any intermediary proxy
  4. Confirm the deployed Honcho version matches the API paths the client uses (v3)
Defensive patterns

Strategy: fallback

Validate before calling

resp = httpx.post(f"{base_url}/v3/workspaces/{workspace}/peers", json={"id": "probe"}, timeout=5)
if resp.status_code == 200:
    try:
        resp.json()
    except ValueError:
        print("base URL serves non-JSON; fix HONCHO base URL")

Try / catch

try:
    client.get_or_create_peer(workspace, peer_id)
except HonchoRequestError as e:
    if "non-JSON response" in str(e):
        # routing/config problem, not transient — do not retry
        raise ConfigurationError("Honcho base URL points at a non-API endpoint")
    raise

Prevention

When it happens

Trigger: Honcho base URL pointing at nginx/another service that returns an HTML 200 or error page on the API path, a proxy intercepting responses, or a version mismatch where the endpoint returns non-JSON content.

Common situations: Base URL set to the frontend/proxy root instead of the Honcho API root, captive portals or corporate proxies rewriting responses, or pointing at an endpoint that no longer exists in the deployed Honcho version.

Related errors


AI-assisted analysis of bytedance/deer-flow@1dd6ba1acb (2026-08-14). Data as JSON: /api/errors/dde674cef1d6c99a. Report an issue: GitHub.