{"record":{"id":"f999b344bcf9f9ad","repo":"t8y2/dbx","slug":"start-s-w-f999b3","errorCode":null,"errorMessage":"start %s: %w","messagePattern":"start (.+?): %w","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"agents/drivers/rabbitmq/bench/agent_compare.go","lineNumber":174,"sourceCode":"\t\t\t\tpanic(fmt.Errorf(\"close startup warmup %s: %w\", agent.Name, err))\n\t\t\t}\n\t\t}\n\t}\n\n\treadySamples := map[string][]float64{}\n\thandshakeSamples := map[string][]float64{}\n\trssSamples := map[string][]int64{}\n\treadyDurations := map[string]time.Duration{}\n\thandshakeDurations := map[string]time.Duration{}\n\tfor iteration := 0; iteration < iterations; iteration++ {\n\t\torder := agents\n\t\tif iteration%2 == 1 {\n\t\t\torder = []agentSpec{agents[1], agents[0]}\n\t\t}\n\t\tfor _, agent := range order {\n\t\t\tprocess, readyDuration, err := startAgent(agent.Command)\n\t\t\tif err != nil {\n\t\t\t\tpanic(fmt.Errorf(\"start %s: %w\", agent.Name, err))\n\t\t\t}\n\t\t\thandshakeStart := time.Now()\n\t\t\tif _, err := process.call(\"handshake\", map[string]any{}); err != nil {\n\t\t\t\tprocess.kill()\n\t\t\t\tpanic(fmt.Errorf(\"handshake %s: %w\", agent.Name, err))\n\t\t\t}\n\t\t\thandshakeDuration := time.Since(handshakeStart)\n\t\t\treadySamples[agent.Name] = append(readySamples[agent.Name], milliseconds(readyDuration))\n\t\t\thandshakeSamples[agent.Name] = append(\n\t\t\t\thandshakeSamples[agent.Name],\n\t\t\t\tmilliseconds(readyDuration+handshakeDuration),\n\t\t\t)\n\t\t\trssSamples[agent.Name] = append(rssSamples[agent.Name], readRSSKB(process.command.Process.Pid))\n\t\t\treadyDurations[agent.Name] += readyDuration\n\t\t\thandshakeDurations[agent.Name] += readyDuration + handshakeDuration\n\t\t\tif err := process.close(); err != nil {\n\t\t\t\tpanic(fmt.Errorf(\"close %s: %w\", agent.Name, err))\n\t\t\t}","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/rabbitmq/bench/agent_compare.go#L156-L192","documentation":"This panic wraps an error from startAgent() during a measured startup iteration. startAgent() fails when the command list is empty, the binary cannot be exec'd (not found, not executable), a stdio pipe cannot be created, or — most commonly — the agent never prints a ready line containing \"ready\":true on stdout (timed out implicitly by scanner returning false or printing something else). It is thrown with panic because without a started agent the iteration (and thus the benchmark) cannot proceed.","triggerScenarios":"Called from benchmarkStartups for each measured iteration: startAgent(agent.Command) returns an error — 'empty agent command', exec.Start() failure (e.g. exec: \"java\": executable file not found in $PATH, permission denied), pipe creation failure, or 'agent did not become ready: ...' when the first stdout line is missing or lacks \"ready\":true.","commonSituations":"JAVA_AGENT_JAR/GO_AGENT env vars empty or pointing at a nonexistent file (jar case: java itself starts but the agent prints an error instead of ready); agent binary lacks +x; PATH lacks java; JVM writes a startup error (bad JVM flags, unsupported --add-opens on older Java) so the first line is an error, not ready; slow cold start with the scanner hitting EOF because the agent crashed before ready.","solutions":["Verify JAVA_AGENT_JAR and GO_AGENT are set to existing, correct artifact paths before running (requiredEnv already checks non-empty, but not existence).","Run the agent command manually in a shell to see why it fails to reach the ready state.","For the java agent, confirm 'java' is on PATH and the JVM version supports the flags in javaAgentCommand (--add-opens needs Java 9+).","Check the agent's ready-line format still contains \"ready\":true — update the agent or the harness if the protocol changed.","Check file permissions/execute bit on the GO_AGENT binary.","Replace panic with error return to let the benchmark report per-agent startup failures."],"exampleFix":"// before\nprocess, readyDuration, err := startAgent(agent.Command)\nif err != nil {\n\tpanic(fmt.Errorf(\"start %s: %w\", agent.Name, err))\n}\n// after\nprocess, readyDuration, err := startAgent(agent.Command)\nif err != nil {\n\treturn nil, fmt.Errorf(\"start %s: %w\", agent.Name, err)\n}","handlingStrategy":"validation","validationCode":"// Validate environment and artifacts BEFORE invoking startAgent\nfor _, key := range []string{\"JAVA_AGENT_JAR\", \"GO_AGENT\"} {\n\tpath := os.Getenv(key)\n\tif strings.TrimSpace(path) == \"\" {\n\t\tlog.Fatalf(\"%s is required\", key)\n\t}\n\tif _, err := os.Stat(path); err != nil {\n\t\tlog.Fatalf(\"%s does not exist: %v\", key, err)\n\t}\n}\nif _, err := exec.LookPath(\"java\"); err != nil {\n\tlog.Fatal(\"java not found in PATH\")\n}\nif info, err := os.Stat(os.Getenv(\"GO_AGENT\")); err == nil && info.Mode()&0o111 == 0 {\n\tlog.Fatal(\"GO_AGENT binary is not executable\")\n}","typeGuard":"func agentReady(line string) bool {\n\tvar ready struct {\n\t\tReady bool `json:\"ready\"`\n\t}\n\treturn json.Unmarshal([]byte(line), &ready) == nil && ready.Ready\n}","tryCatchPattern":"func safeStart(command []string, name string) (p *agentProcess, d time.Duration, err error) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\terr = fmt.Errorf(\"start %s: %v\", name, r)\n\t\t}\n\t}()\n\treturn startAgent(command)\n}","preventionTips":["Stat every artifact path and exec.LookPath every binary before the run.","Keep the agent's ready-line contract (\"ready\":true) documented and versioned.","Run the agent once manually to confirm it reaches ready in the target environment.","Verify JVM version supports all flags in javaAgentCommand (e.g. --add-opens requires Java 9+).","Set an explicit readiness timeout in startAgent instead of relying on scanner EOF."],"tags":["go","subprocess","exec","startup","panic"],"backgroundTag":"process-start-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"}