{"record":{"id":"0678202866cc453b","repo":"t8y2/dbx","slug":"agent-did-not-become-ready-s-067820","errorCode":null,"errorMessage":"agent did not become ready: %s","messagePattern":"agent did not become ready: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/rabbitmq/bench/agent_compare.go","lineNumber":328,"sourceCode":"\tstdout, err := process.command.StdoutPipe()\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\tprocess.command.Stderr = os.Stderr\n\tprocess.stdin = stdin\n\tprocess.reader = bufio.NewScanner(stdout)\n\tprocess.reader.Buffer(make([]byte, 64*1024), 512*1024*1024)\n\tstart := time.Now()\n\tif err := process.command.Start(); err != nil {\n\t\treturn nil, 0, err\n\t}\n\tif !process.reader.Scan() {\n\t\tprocess.kill()\n\t\treturn nil, 0, fmt.Errorf(\"agent did not become ready: %v\", process.reader.Err())\n\t}\n\tif !strings.Contains(process.reader.Text(), `\"ready\":true`) {\n\t\tprocess.kill()\n\t\treturn nil, 0, fmt.Errorf(\"agent did not become ready: %s\", process.reader.Text())\n\t}\n\treturn process, time.Since(start), nil\n}\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","sourceCodeStart":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/rabbitmq/bench/agent_compare.go#L310-L346","documentation":"After a successful Scan, startAgent validates the readiness line contains \"ready\":true. If the first stdout line is something else, the agent is killed and this error includes the unexpected text verbatim, signaling a protocol violation on the startup handshake.","triggerScenarios":"The agent emits a log line, warning, or banner on stdout as its first output instead of the JSON readiness line, or prints a readiness line with different formatting (e.g. \"ready\": false or plain text).","commonSituations":"A logging library configured to write INFO logs to stdout pollutes the handshake; agent version changed its ready-line format; agent prints deprecation warnings before readiness.","solutions":["Configure all agent logging to stderr, keeping stdout for the JSON protocol","Confirm the agent prints {\"ready\":true} exactly once as the first stdout line","Align the agent version with what the benchmark expects (ready-line contract)","Inspect the %s text in the error to see exactly what was emitted instead"],"exampleFix":"// before\nlog.Printf(\"agent starting\") // goes to stdout by default in some setups\nfmt.Println(`{\"ready\":true}`)\n// after\nlog.SetOutput(os.Stderr)\nfmt.Println(`{\"ready\":true}`)","handlingStrategy":"validation","validationCode":"// enforce stdout purity: in the agent, before anything else\nif os.Getenv(\"AGENT_PROTOCOL_STDOUT\") == \"1\" {\n    log.SetOutput(os.Stderr)\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"agent did not become ready\") {\n    log.Fatalf(\"ready-line protocol violation: %v\", err)\n}","preventionTips":["Keep stdout reserved exclusively for the JSON protocol","Add a startup handshake integration test comparing the first stdout line","Pin agent versions in the benchmark matrix to match the ready-line contract"],"tags":["subprocess","readiness","protocol"],"backgroundTag":"readiness-handshake-failed","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"}