{"record":{"id":"6799531bbf9c0ae1","repo":"commaai/openpilot","slug":"error-s-requires-a-value","errorCode":null,"errorMessage":"error: %s requires a value\n","messagePattern":"error: (.+?) requires a value\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"openpilot/tools/cabana/cabana.cc","lineNumber":65,"sourceCode":"          \"  --wide-road               load wide road camera (alias: --ecam)\\n\"\n          \"  --cabin                   load cabin camera (alias: --dcam)\\n\"\n          \"  --msgq                    read can messages from the msgq\\n\"\n          \"  --panda                   read can messages from panda\\n\"\n          \"  --panda-serial <serial>   read can messages from panda with given serial\\n\"\n#ifdef __linux__\n          \"  --socketcan <device>      read can messages from given SocketCAN device\\n\"\n#endif\n          \"  --zmq <ip-address>        read can messages from zmq at the specified ip-address\\n\"\n          \"  --data_dir <dir>          local directory with routes\\n\"\n          \"  --no-vipc                 do not output video\\n\"\n          \"  --dbc <file>              dbc file to open\\n\",\n          argv0);\n}\n\n// Returns true if value was consumed from argv[i+1].\nbool takeValue(int argc, char *argv[], int &i, std::string &out) {\n  if (i + 1 >= argc) {\n    fprintf(stderr, \"error: %s requires a value\\n\", argv[i]);\n    return false;\n  }\n  out = argv[++i];\n  return true;\n}\n\n// Returns 0 to continue, or a process exit code (0 for --help, 1 for errors).\nint parseArgs(int argc, char *argv[], CabanaArgs &args, bool &ok) {\n  ok = false;\n  for (int i = 1; i < argc; ++i) {\n    const char *a = argv[i];\n    if (std::strcmp(a, \"--help\") == 0 || std::strcmp(a, \"-h\") == 0) {\n      printUsage(argv[0]);\n      return 0;\n    } else if (std::strcmp(a, \"--demo\") == 0) {\n      args.demo = true;\n    } else if (std::strcmp(a, \"--auto\") == 0) {\n      args.auto_source = true;","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/commaai/openpilot/blob/516ec1e68203439a73f340f1d0b3b91eabc626ee/openpilot/tools/cabana/cabana.cc#L47-L83","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Supply the value immediately after the option: cabana --zmq 192.168.1.10.","In scripts, quote and default-check variables: cabana --dbc \"${DBC:?DBC not set}\" so the script fails earlier with a clear message.","Run cabana --help to see which options take values."],"exampleFix":"# before\ncabana --dbc              # option is last arg -> 'error: --dbc requires a value'\n\n# after\ncabana --dbc my_car.dbc <route>","handlingStrategy":"validation","validationCode":"# before invoking, ensure every value-taking option has a non-empty value\nopts_with_values = {'--zmq': zmq_ip, '--dbc': dbc_file, '--data_dir': data_dir, '--panda-serial': serial, '--socketcan': can_dev}\nargv = ['cabana'] + [x for opt, val in opts_with_values.items() if val for x in (opt, val)] + ([route] if route else [])","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never end a command with a value-taking flag; always append its value.","Use ${VAR:?msg} in scripts so unset variables abort before cabana runs."],"tags":["cabana","cli","usage","argument-parsing","openpilot"],"backgroundTag":null,"analyzedSha":"516ec1e68203439a73f340f1d0b3b91eabc626ee","analyzedAt":"2026-08-15T00:17:37.461Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}