{"record":{"id":"dfef8aa54bea9690","repo":"t8y2/dbx","slug":"response-error-message-dfef8a","errorCode":null,"errorMessage":"${response.Error.Message}","messagePattern":"\\$\\{response\\.Error\\.Message\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/rabbitmq/bench/agent_compare.go","lineNumber":359,"sourceCode":"\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()\n\tif callError != nil {\n\t\treturn callError\n\t}\n\treturn waitError\n}\n\nfunc (process *agentProcess) kill() {\n\tif process != nil && process.command != nil && process.command.Process != nil {\n\t\t_ = process.command.Process.Kill()\n\t\t_, _ = process.command.Process.Wait()","sourceCodeStart":341,"sourceCodeEnd":377,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/rabbitmq/bench/agent_compare.go#L341-L377","documentation":"The agent-process JSON-RPC client surfaced the error message returned by the agent itself: when response.Error is non-null, call() wraps its Message in a plain Go error. This is a remote-side failure (agent method returned a JSON-RPC error object), not a local transport failure — transport and id-matching problems raise different errors.","triggerScenarios":"Any JSON-RPC call to the agent process (e.g. process.call(\"shutdown\", ...)) where the agent replies with {\"error\": {\"message\": \"...\"}}, such as unknown method, invalid params, or an internal agent failure.","commonSituations":"Calling a method the agent does not implement; passing wrong-shaped params; the agent crashing mid-request and its framework emitting an error response; version mismatch where the bench expects a method the agent no longer exposes.","solutions":["Read the surfaced message — it comes from the agent — and fix the offending call (method name, params) on the client side.","Verify client and agent versions match and that the RPC method exists in the agent's handler registry.","Log response.Error.Code alongside Message (extend call() to return both) to pinpoint the agent-side failure class."],"exampleFix":"// before\nif response.Error != nil {\n    return nil, errors.New(response.Error.Message)\n}\n// after\nif response.Error != nil {\n    return nil, fmt.Errorf(\"rpc error (code %d): %s\", response.Error.Code, response.Error.Message)\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"result, err := process.call(\"shutdown\", map[string]any{})\nif err != nil {\n    if strings.Contains(err.Error(), \"rpc error\") {\n        log.Printf(\"agent rejected call: %v\", err)\n        return nil // treat as agent-side failure, not transport\n    }\n    return err\n}","preventionTips":["Check the method name and payload shape against the agent's handler registry.","Pin client and agent to matching versions.","Log the JSON-RPC error code, not just the message, to classify failures.","Add an agent-side health/ping method used before real calls."],"tags":["json-rpc","ipc","process"],"backgroundTag":"rpc-error-response","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"}