t8y2/dbx · error

empty agent command

Error message

empty agent command

What it means

startAgent launches a benchmark agent subprocess via exec.Command and refuses to proceed when the argv slice is empty, since there is no executable to run. It is a fail-fast guard before any pipes or process management happen.

Source

Thrown at agents/drivers/kingbase-go/bench/agent_compare.go:185

		"-Dsun.stderr.encoding=UTF-8",
		"-Djava.net.useSystemProxies=false",
		"-Dhttp.proxyHost=",
		"-Dhttps.proxyHost=",
		"-DsocksProxyHost=",
		"-Doracle.net.disableOob=true",
		"-Doracle.jdbc.javaNetNio=false",
		"-Djava.net.preferIPv4Stack=true",
		"--add-opens=java.sql/java.sql=ALL-UNNAMED",
		"-XX:TieredStopAtLevel=1",
		"-XX:+UseSerialGC",
		"-jar",
		jarPath,
	}
}

func startAgent(argv []string) (*agentProcess, time.Duration, error) {
	if len(argv) == 0 {
		return nil, 0, errors.New("empty agent command")
	}
	process := &agentProcess{}
	process.command = exec.Command(argv[0], argv[1:]...)
	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 {
		return nil, 0, err

View on GitHub (pinned to c0390bff16)

Solutions

  1. Supply a non-empty agent command (executable path plus arguments) when invoking the benchmark harness
  2. Check the config/env/flag that feeds the agent command and give it a default or a startup validation
  3. Fail early in main with a usage message if the agent command is missing

Example fix

// before
agentCmd := os.Getenv("AGENT_CMD") // ""
p, _, err := startAgent(strings.Fields(agentCmd))
// after
agentCmd := os.Getenv("AGENT_CMD")
if strings.TrimSpace(agentCmd) == "" { log.Fatal("AGENT_CMD must be set") }
p, _, err := startAgent(strings.Fields(agentCmd))
Defensive patterns

Strategy: validation

Validate before calling

if len(argv) == 0 || strings.TrimSpace(argv[0]) == "" { return errors.New("agent command must be a non-empty argv") }

Try / catch

p, d, err := startAgent(argv); if err != nil { log.Fatalf("failed to start agent: %v", err) }

Prevention

When it happens

Trigger: Calling startAgent with a nil or zero-length argv slice, typically when the agent command string was empty or the config produced no arguments.

Common situations: Benchmark config/env var holding the agent command is unset or empty; string splitting on whitespace of an empty string yields no tokens; a CLI flag like -agent was not provided to the compare harness.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


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