{"record":{"id":"e47684e16f646788","repo":"t8y2/dbx","slug":"empty-agent-command","errorCode":null,"errorMessage":"empty agent command","messagePattern":"empty agent command","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/kingbase-go/bench/agent_compare.go","lineNumber":185,"sourceCode":"\t\t\"-Dsun.stderr.encoding=UTF-8\",\n\t\t\"-Djava.net.useSystemProxies=false\",\n\t\t\"-Dhttp.proxyHost=\",\n\t\t\"-Dhttps.proxyHost=\",\n\t\t\"-DsocksProxyHost=\",\n\t\t\"-Doracle.net.disableOob=true\",\n\t\t\"-Doracle.jdbc.javaNetNio=false\",\n\t\t\"-Djava.net.preferIPv4Stack=true\",\n\t\t\"--add-opens=java.sql/java.sql=ALL-UNNAMED\",\n\t\t\"-XX:TieredStopAtLevel=1\",\n\t\t\"-XX:+UseSerialGC\",\n\t\t\"-jar\",\n\t\tjarPath,\n\t}\n}\n\nfunc startAgent(argv []string) (*agentProcess, time.Duration, error) {\n\tif len(argv) == 0 {\n\t\treturn nil, 0, errors.New(\"empty agent command\")\n\t}\n\tprocess := &agentProcess{}\n\tprocess.command = exec.Command(argv[0], argv[1:]...)\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 {\n\t\treturn nil, 0, err","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/kingbase-go/bench/agent_compare.go#L167-L203","documentation":"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.","triggerScenarios":"Calling startAgent with a nil or zero-length argv slice, typically when the agent command string was empty or the config produced no arguments.","commonSituations":"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.","solutions":["Supply a non-empty agent command (executable path plus arguments) when invoking the benchmark harness","Check the config/env/flag that feeds the agent command and give it a default or a startup validation","Fail early in main with a usage message if the agent command is missing"],"exampleFix":"// before\nagentCmd := os.Getenv(\"AGENT_CMD\") // \"\"\np, _, err := startAgent(strings.Fields(agentCmd))\n// after\nagentCmd := os.Getenv(\"AGENT_CMD\")\nif strings.TrimSpace(agentCmd) == \"\" { log.Fatal(\"AGENT_CMD must be set\") }\np, _, err := startAgent(strings.Fields(agentCmd))","handlingStrategy":"validation","validationCode":"if len(argv) == 0 || strings.TrimSpace(argv[0]) == \"\" { return errors.New(\"agent command must be a non-empty argv\") }","typeGuard":null,"tryCatchPattern":"p, d, err := startAgent(argv); if err != nil { log.Fatalf(\"failed to start agent: %v\", err) }","preventionTips":["Validate the agent command config at program startup, before benchmarking begins","Use required flags/env vars with defaults for the agent executable path","Split the command string with strings.Fields and check the result is non-empty"],"tags":["process","configuration","kingbase"],"backgroundTag":"missing-required-parameter","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"}