{"record":{"id":"4de61a7bfeb13149","repo":"t8y2/dbx","slug":"self-candidate-name-method-json-dumps-respon","errorCode":null,"errorMessage":"{self.candidate.name} {method}: {json.dumps(response['error'], ensure_ascii=False)}","messagePattern":"\\{self\\.candidate\\.name\\} \\{method\\}: \\{json\\.dumps\\(response\\['error'\\], ensure_ascii=False\\)\\}","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"agents/drivers/cassandra-go/bench/agent_compare.py","lineNumber":80,"sourceCode":"            \"method\": method,\n            \"params\": params or {},\n        }\n        assert self.process.stdin is not None\n        assert self.process.stdout is not None\n        self.process.stdin.write(json.dumps(request, separators=(\",\", \":\")) + \"\\n\")\n        self.process.stdin.flush()\n        while True:\n            line = self.process.stdout.readline()\n            if line == \"\" and self.process.poll() is not None:\n                raise RuntimeError(self._failure(f\"agent exited during {method}\"))\n            try:\n                response = json.loads(line)\n            except json.JSONDecodeError:\n                continue\n            if response.get(\"id\") != self.request_id:\n                continue\n            if response.get(\"error\") is not None:\n                raise RuntimeError(f\"{self.candidate.name} {method}: {json.dumps(response['error'], ensure_ascii=False)}\")\n            return response.get(\"result\")\n\n    def rss_kib(self) -> int:\n        if self.candidate.rss_command:\n            output = subprocess.check_output(self.candidate.rss_command, shell=True, text=True).strip()\n            return int(output)\n        output = subprocess.check_output(\n            [\"ps\", \"-o\", \"rss=\", \"-p\", str(self.process.pid)],\n            text=True,\n        ).strip()\n        return int(output or \"0\")\n\n    def close(self) -> bool:\n        if self.process.poll() is not None:\n            return True\n        try:\n            self.call(\"shutdown\")\n        except Exception:","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/cassandra-go/bench/agent_compare.py#L62-L98","documentation":"call() raises RuntimeError when the JSON-RPC response for the current request id contains an \"error\" member. The message embeds the candidate agent's name, the method, and the serialized error object, attributing the failure to the specific agent and RPC.","triggerScenarios":"The agent successfully responds to a call(method, params) but reports a JSON-RPC error (e.g. method not found, invalid params, internal error in the handler).","commonSituations":"Bench invoking a method the agent doesn't implement; workload sending params the agent rejects; agent-side internal error on a particular dataset or query.","solutions":["Read the embedded JSON-RPC error message to identify code/message","Verify the method name and params match the agent's expected protocol","Run the same request against the agent directly (e.g. via a JSON-RPC client) to reproduce","Update the agent if the method is new and the binary is stale"],"exampleFix":"// before\ncall(\"nonexistent/method\", {})\n// after\ncall(\"get\", {\"key\": \"k1\"})","handlingStrategy":"try-catch","validationCode":"# validate the method exists in the agent's advertised surface before calling\navailable = set(agent.call(\"rpc.discover\", {}).get(\"methods\", []))\nassert method in available, f\"agent does not implement {method}\"","typeGuard":null,"tryCatchPattern":"try:\n    result = agent.call(method, params)\nexcept RuntimeError as exc:\n    if exc.args and method in str(exc.args[0]) and str(agent.candidate.name) in str(exc.args[0]):\n        print(f\"JSON-RPC error from agent: {exc}\")\n        sys.exit(5)\n    raise","preventionTips":["Keep the bench's RPC method names and params in sync with the agent protocol","Version-check the agent at startup and skip methods it doesn't support","Log the full JSON-RPC error object for debugging","Smoke-test each method against the agent before running the full workload"],"tags":["python","json-rpc","ipc","agent-error"],"backgroundTag":"json-rpc-error-response","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}