t8y2/dbx · error · RuntimeError

command failed ({' '.join(command)}): stdout: {completed.std

Error message

command failed ({' '.join(command)}):
stdout:
{completed.stdout}
stderr:
{completed.stderr}

What it means

run_json() executes a benchmark subprocess and requires exit code 0. On any non-zero return code it raises RuntimeError embedding the full command line plus captured stdout and stderr so the underlying failure is visible. check=False is used deliberately so this richer error is raised instead of CalledProcessError.

Source

Thrown at agents/drivers/iotdb/bench/run.py:117

            with socket.create_connection((host, port), timeout=1):
                return
        except OSError:
            time.sleep(0.5)
    raise TimeoutError(f"IoTDB is not reachable at {host}:{port}")


def run_json(command: list[str], environment: dict[str, str]) -> dict:
    completed = subprocess.run(
        command,
        env=environment,
        text=True,
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE,
        check=False,
        timeout=env_float("BENCH_COMMAND_TIMEOUT", 180.0),
    )
    if completed.returncode != 0:
        raise RuntimeError(
            f"command failed ({' '.join(command)}):\nstdout:\n{completed.stdout}\nstderr:\n{completed.stderr}"
        )
    for line in reversed(completed.stdout.splitlines()):
        try:
            value = json.loads(line)
        except json.JSONDecodeError:
            continue
        if isinstance(value, dict):
            return value
    raise RuntimeError(f"command returned no JSON ({' '.join(command)}):\n{completed.stdout}")


def measure_rss(command: list[str], environment: dict[str, str]) -> float:
    process = subprocess.Popen(
        command,
        env=environment | {"IOTDB_BENCH_MODE": "hold"},
        text=True,
        stdout=subprocess.PIPE,

View on GitHub (pinned to c0390bff16)

Solutions

  1. Read the captured stderr/stdout embedded in the RuntimeError message for the root cause
  2. Run the failing command manually with the same env to reproduce interactively
  3. Check the tool's version/arguments match what run_json passes
  4. Increase BENCH_COMMAND_TIMEOUT if the process is being killed by timeout
  5. Verify the executable exists and is runnable (permissions, shebang, runtime present)

Example fix

// before
run_json(cmd, env)  # RuntimeError: command failed (...): exit 1
// after
# inspect message stderr, fix tool args, then re-run
result = run_json(corrected_cmd, env)
Defensive patterns

Strategy: try-catch

Validate before calling

import shutil

def preflight_command(cmd: list[str]) -> None:
    if shutil.which(cmd[0]) is None:
        raise SystemExit(f"command not found: {cmd[0]}")

Try / catch

try:
    result = run_json(command, environment)
except RuntimeError as e:
    print(f"benchmark command failed:\n{e}")
    raise SystemExit(1)  # message already contains stdout/stderr for diagnosis

Prevention

When it happens

Trigger: The spawned benchmark command (called by main) exits non-zero — e.g. the JVM/IoTDB bench tool crashes, bad arguments, missing dependencies, OOM kill, or the command's own internal error — and subprocess.run returns returncode != 0.

Common situations: Wrong CLI arguments after a tool upgrade; missing Java/classpath; benchmark script failing on bad config; out-of-memory or SIGKILL; permission denied on the executable.

Related errors


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