{"record":{"id":"69fa844fbae21cc9","repo":"t8y2/dbx","slug":"empty-agent-command-69fa84","errorCode":null,"errorMessage":"empty agent command","messagePattern":"empty agent command","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/rabbitmq/bench/agent_compare.go","lineNumber":301,"sourceCode":"\t}\n\treturn benchmarkResult{\n\t\tAgent:      agent,\n\t\tWorkload:   workload,\n\t\tRound:      round,\n\t\tOperations: operations,\n\t\tErrors:     errorsCount,\n\t\tDurationMS: milliseconds(duration),\n\t\tQPS:        qps,\n\t\tMeanMS:     mean,\n\t\tP50MS:      percentile(sorted, 0.50),\n\t\tP95MS:      percentile(sorted, 0.95),\n\t\tP99MS:      percentile(sorted, 0.99),\n\t}\n}\n\nfunc startAgent(command []string) (*agentProcess, time.Duration, error) {\n\tif len(command) == 0 {\n\t\treturn nil, 0, errors.New(\"empty agent command\")\n\t}\n\tprocess := &agentProcess{}\n\tprocess.command = exec.Command(command[0], command[1:]...)\n\tprocess.command.Env = sanitizedEnv()\n\tstdin, err := process.command.StdinPipe()\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\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 {","sourceCodeStart":283,"sourceCodeEnd":319,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/rabbitmq/bench/agent_compare.go#L283-L319","documentation":"startAgent spawns the benchmark agent process via exec.Command(command[0], ...) and guards against an empty command slice, since exec.Command would panic or misbehave on an empty argv. The benchmark callers (benchmarkStartups, benchmarkRPC) build the command from configuration, so an empty slice means the agent under test was never resolved.","triggerScenarios":"Running the rabbitmq bench with an empty or missing agent command configuration (e.g. no CLI args or config field supplying the agent binary), so benchmarkStartups/benchmarkRPC call startAgent(nil) or startAgent([]string{}).","commonSituations":"Forgetting to pass the agent binary/path as a bench argument; a config file field left blank; a script stripping args; environment or CI matrix entry that omits the command.","solutions":["Supply the agent command (binary plus args) via the bench's flags/config before running.","Validate the command slice is non-empty in the caller before invoking benchmarks and fail fast with a clear config error.","Check the bench harness/config loading for code that drops empty-string args, leaving a zero-length slice."],"exampleFix":"// before\ncommand := cfg.AgentCommand // []string{} when not configured\nproc, d, err := startAgent(command)\n// after\nif len(cfg.AgentCommand) == 0 {\n    return fmt.Errorf(\"agent command not configured: set --agent or AGENT_CMD\")\n}\nproc, d, err := startAgent(cfg.AgentCommand)","handlingStrategy":"validation","validationCode":"if len(command) == 0 || strings.TrimSpace(command[0]) == \"\" {\n    return errors.New(\"agent command is empty; supply the agent binary path\")\n}","typeGuard":"func hasCommand(argv []string) bool {\n    return len(argv) > 0 && strings.TrimSpace(argv[0]) != \"\"\n}","tryCatchPattern":null,"preventionTips":["Validate bench config/flags at startup, before spawning anything.","Fail fast in config loading when the agent command field is empty.","Use os/exec.NotFound-aware error wrapping so spawn failures are distinguishable from empty commands."],"tags":["process","configuration","benchmark"],"backgroundTag":"missing-command-argument","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"}