{"record":{"id":"d3204a64d121f34a","repo":"t8y2/dbx","slug":"agent-response-unavailable-v","errorCode":null,"errorMessage":"agent response unavailable: %v","messagePattern":"agent response unavailable: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/rabbitmq/bench/agent_compare.go","lineNumber":349,"sourceCode":"}\n\nfunc (process *agentProcess) call(method string, params map[string]any) (json.RawMessage, error) {\n\tprocess.nextID++\n\trequest := map[string]any{\n\t\t\"jsonrpc\": \"2.0\",\n\t\t\"id\":      process.nextID,\n\t\t\"method\":  method,\n\t\t\"params\":  params,\n\t}\n\tpayload, err := json.Marshal(request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err := process.stdin.Write(append(payload, '\\n')); err != nil {\n\t\treturn nil, err\n\t}\n\tif !process.reader.Scan() {\n\t\treturn nil, fmt.Errorf(\"agent response unavailable: %v\", process.reader.Err())\n\t}\n\tvar response agentResponse\n\tif err := json.Unmarshal(process.reader.Bytes(), &response); err != nil {\n\t\treturn nil, err\n\t}\n\tif response.ID != process.nextID {\n\t\treturn nil, fmt.Errorf(\"response id %d does not match request id %d\", response.ID, process.nextID)\n\t}\n\tif response.Error != nil {\n\t\treturn nil, errors.New(response.Error.Message)\n\t}\n\treturn response.Result, nil\n}\n\nfunc (process *agentProcess) close() error {\n\t_, callError := process.call(\"shutdown\", map[string]any{})\n\t_ = process.stdin.Close()\n\twaitError := process.command.Wait()","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/rabbitmq/bench/agent_compare.go#L331-L367","documentation":"In agentProcess.call, after writing the JSON-RPC request to the agent's stdin, the harness reads one line from the agent's stdout; if Scan fails there is no response and this error wraps the scanner's Err. It typically means the agent died or hung mid-request.","triggerScenarios":"reader.Scan() returns false right after a request was written — the agent exited (crash, OOM kill), its stdout pipe broke, or the agent never answered and the pipe closed.","commonSituations":"Agent killed by OOM under load; agent crashed on an unhandled method/panic; connection to RabbitMQ dropped and agent exited; benchmark machine resource limits killing the child.","solutions":["Inspect reader.Err()/agent stderr for the crash reason and fix the underlying agent fault","Ensure the broker connection survives the benchmark duration (timeouts, keepalives)","Check for OOM/signals (dmesg, ulimit) killing the child under load","Add retry/reconnect logic in the agent instead of exiting on transient broker errors"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"res, err := process.call(method, params)\nif err != nil && strings.Contains(err.Error(), \"agent response unavailable\") {\n    // agent died mid-call; capture stderr and exit state\n    log.Fatalf(\"agent unavailable: %v, exit state: %v\", err, process.command.ProcessState)\n}","preventionTips":["Monitor the child process (Wait) concurrently to surface crashes with their cause","Raise memory limits if the agent is OOM-killed under load","Make the agent resilient to transient broker errors instead of exiting"],"tags":["rpc","subprocess","io"],"backgroundTag":"rpc-call-failed","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}