{"record":{"id":"dde674cef1d6c99a","repo":"bytedance/deer-flow","slug":"honcho-returned-non-json-response-post-path-e","errorCode":null,"errorMessage":"Honcho returned non-JSON response: POST {path}: {exc}","messagePattern":"Honcho returned non-JSON response: POST (.+?): (.+?)","errorType":"http","errorClass":"HonchoRequestError","httpStatus":null,"severity":"error","filePath":"backend/packages/harness/deerflow/agents/memory/backends/honcho/client.py","lineNumber":48,"sourceCode":"            headers=headers,\n            timeout=httpx.Timeout(config.timeout_seconds, connect=config.connect_timeout_seconds),\n            transport=transport,\n        )\n\n    def close(self) -> None:\n        self._http.close()\n\n    def _post(self, path: str, payload: Any) -> Any:\n        try:\n            response = self._http.post(path, json=payload)\n            response.raise_for_status()\n        except httpx.HTTPError as exc:\n            raise HonchoRequestError(f\"Honcho request failed: POST {path}: {exc}\") from exc\n        if response.content:\n            try:\n                return response.json()\n            except ValueError as exc:\n                raise HonchoRequestError(f\"Honcho returned non-JSON response: POST {path}: {exc}\") from exc\n        return None\n\n    def get_or_create_peer(self, workspace: str, peer_id: str) -> None:\n        self._post(f\"/v3/workspaces/{workspace}/peers\", {\"id\": peer_id})\n\n    def get_or_create_session(self, workspace: str, session_id: str) -> None:\n        self._post(f\"/v3/workspaces/{workspace}/sessions\", {\"id\": session_id})\n\n    def set_session_peers(self, workspace: str, session_id: str, peer_ids: list[str]) -> None:\n        self._post(f\"/v3/workspaces/{workspace}/sessions/{session_id}/peers\", {peer_id: {} for peer_id in peer_ids})\n\n    def add_messages(self, workspace: str, session_id: str, messages: list[dict[str, str]]) -> None:\n        self._post(f\"/v3/workspaces/{workspace}/sessions/{session_id}/messages\", {\"messages\": messages})\n\n    def working_representation(self, workspace: str, peer_id: str, *, max_conclusions: int = 25) -> str:\n        data = self._post(f\"/v3/workspaces/{workspace}/peers/{peer_id}/representation\", {\"max_conclusions\": max_conclusions})\n        if isinstance(data, dict):\n            return str(data.get(\"representation\") or \"\")","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/backend/packages/harness/deerflow/agents/memory/backends/honcho/client.py#L30-L66","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Correct the Honcho base URL to the API root (e.g. https://api.honcho.dev, not a proxy serving HTML)","Reproduce manually: curl -X POST <base>/v3/workspaces/<ws>/peers -d '{\"id\":\"p\"}' -H 'Content-Type: application/json' and inspect the body","Check Accept/Content-Type handling on any intermediary proxy","Confirm the deployed Honcho version matches the API paths the client uses (v3)"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"resp = httpx.post(f\"{base_url}/v3/workspaces/{workspace}/peers\", json={\"id\": \"probe\"}, timeout=5)\nif resp.status_code == 200:\n    try:\n        resp.json()\n    except ValueError:\n        print(\"base URL serves non-JSON; fix HONCHO base URL\")","typeGuard":null,"tryCatchPattern":"try:\n    client.get_or_create_peer(workspace, peer_id)\nexcept HonchoRequestError as e:\n    if \"non-JSON response\" in str(e):\n        # routing/config problem, not transient — do not retry\n        raise ConfigurationError(\"Honcho base URL points at a non-API endpoint\")\n    raise","preventionTips":["Point the Honcho base URL at the API root, never at an HTML-serving proxy","Smoke-test one POST and assert the response is JSON during deployment checks","Keep the client's API version (v3) in sync with the deployed Honcho service"],"tags":["memory","honcho","http","json","configuration"],"backgroundTag":null,"analyzedSha":"1dd6ba1acb03700589994b0366c5d1c7d05e2eff","analyzedAt":"2026-08-14T21:20:34.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}