t8y2/dbx · error

empty agent command

Error message

empty agent command

What it means

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.

Source

Thrown at agents/drivers/rabbitmq/bench/agent_compare.go:301

	}
	return benchmarkResult{
		Agent:      agent,
		Workload:   workload,
		Round:      round,
		Operations: operations,
		Errors:     errorsCount,
		DurationMS: milliseconds(duration),
		QPS:        qps,
		MeanMS:     mean,
		P50MS:      percentile(sorted, 0.50),
		P95MS:      percentile(sorted, 0.95),
		P99MS:      percentile(sorted, 0.99),
	}
}

func startAgent(command []string) (*agentProcess, time.Duration, error) {
	if len(command) == 0 {
		return nil, 0, errors.New("empty agent command")
	}
	process := &agentProcess{}
	process.command = exec.Command(command[0], command[1:]...)
	process.command.Env = sanitizedEnv()
	stdin, err := process.command.StdinPipe()
	if err != nil {
		return nil, 0, err
	}
	stdout, err := process.command.StdoutPipe()
	if err != nil {
		return nil, 0, err
	}
	process.command.Stderr = os.Stderr
	process.stdin = stdin
	process.reader = bufio.NewScanner(stdout)
	process.reader.Buffer(make([]byte, 64*1024), 512*1024*1024)
	start := time.Now()
	if err := process.command.Start(); err != nil {

View on GitHub (pinned to c0390bff16)

Solutions

  1. Supply the agent command (binary plus args) via the bench's flags/config before running.
  2. Validate the command slice is non-empty in the caller before invoking benchmarks and fail fast with a clear config error.
  3. Check the bench harness/config loading for code that drops empty-string args, leaving a zero-length slice.

Example fix

// before
command := cfg.AgentCommand // []string{} when not configured
proc, d, err := startAgent(command)
// after
if len(cfg.AgentCommand) == 0 {
    return fmt.Errorf("agent command not configured: set --agent or AGENT_CMD")
}
proc, d, err := startAgent(cfg.AgentCommand)
Defensive patterns

Strategy: validation

Validate before calling

if len(command) == 0 || strings.TrimSpace(command[0]) == "" {
    return errors.New("agent command is empty; supply the agent binary path")
}

Type guard

func hasCommand(argv []string) bool {
    return len(argv) > 0 && strings.TrimSpace(argv[0]) != ""
}

Prevention

When it happens

Trigger: 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{}).

Common situations: 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.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/69fa844fbae21cc9. Report an issue: GitHub.