commaai/openpilot · error

error: %s requires a value

Error message

error: %s requires a value

What it means

Printed by takeValue() in cabana's argument parser when an option that takes a value (--zmq, --dbc, --data_dir, --panda-serial, --socketcan) is the last argument on the command line, so argv[i+1] doesn't exist. parseArgs then returns 1 and cabana exits; the message names the offending option.

Source

Thrown at openpilot/tools/cabana/cabana.cc:65

          "  --wide-road               load wide road camera (alias: --ecam)\n"
          "  --cabin                   load cabin camera (alias: --dcam)\n"
          "  --msgq                    read can messages from the msgq\n"
          "  --panda                   read can messages from panda\n"
          "  --panda-serial <serial>   read can messages from panda with given serial\n"
#ifdef __linux__
          "  --socketcan <device>      read can messages from given SocketCAN device\n"
#endif
          "  --zmq <ip-address>        read can messages from zmq at the specified ip-address\n"
          "  --data_dir <dir>          local directory with routes\n"
          "  --no-vipc                 do not output video\n"
          "  --dbc <file>              dbc file to open\n",
          argv0);
}

// Returns true if value was consumed from argv[i+1].
bool takeValue(int argc, char *argv[], int &i, std::string &out) {
  if (i + 1 >= argc) {
    fprintf(stderr, "error: %s requires a value\n", argv[i]);
    return false;
  }
  out = argv[++i];
  return true;
}

// Returns 0 to continue, or a process exit code (0 for --help, 1 for errors).
int parseArgs(int argc, char *argv[], CabanaArgs &args, bool &ok) {
  ok = false;
  for (int i = 1; i < argc; ++i) {
    const char *a = argv[i];
    if (std::strcmp(a, "--help") == 0 || std::strcmp(a, "-h") == 0) {
      printUsage(argv[0]);
      return 0;
    } else if (std::strcmp(a, "--demo") == 0) {
      args.demo = true;
    } else if (std::strcmp(a, "--auto") == 0) {
      args.auto_source = true;

View on GitHub (pinned to 516ec1e682)

Solutions

  1. Supply the value immediately after the option: cabana --zmq 192.168.1.10.
  2. In scripts, quote and default-check variables: cabana --dbc "${DBC:?DBC not set}" so the script fails earlier with a clear message.
  3. Run cabana --help to see which options take values.

Example fix

# before
cabana --dbc              # option is last arg -> 'error: --dbc requires a value'

# after
cabana --dbc my_car.dbc <route>
Defensive patterns

Strategy: validation

Validate before calling

# before invoking, ensure every value-taking option has a non-empty value
opts_with_values = {'--zmq': zmq_ip, '--dbc': dbc_file, '--data_dir': data_dir, '--panda-serial': serial, '--socketcan': can_dev}
argv = ['cabana'] + [x for opt, val in opts_with_values.items() if val for x in (opt, val)] + ([route] if route else [])

Prevention

When it happens

Trigger: Running `cabana --zmq` or `cabana --dbc` with nothing after it — i+1 >= argc fails in takeValue and the option name is printed. Any flag-taking-value in final position triggers it.

Common situations: Truncated shell commands (hit enter too early), scripts dropping an empty variable so the value argument vanishes (`cabana --dbc $DBC` with DBC unset), or copy-pasting from docs that line-wrapped the value away.

Related errors


AI-assisted analysis of commaai/openpilot@516ec1e682 (2026-08-15). Data as JSON: /api/errors/6799531bbf9c0ae1. Report an issue: GitHub.