{"record":{"id":"1ac2b2159254c080","repo":"commaai/openpilot","slug":"error-unexpected-argument-s","errorCode":null,"errorMessage":"error: unexpected argument %s\n","messagePattern":"error: unexpected argument (.+?)\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"openpilot/tools/cabana/cabana.cc","lineNumber":119,"sourceCode":"      fprintf(stderr, \"error: --socketcan is only supported on Linux\\n\");\n      return 1;\n#endif\n    } else if (std::strcmp(a, \"--zmq\") == 0) {\n      if (!takeValue(argc, argv, i, args.zmq)) return 1;\n    } else if (std::strcmp(a, \"--data_dir\") == 0) {\n      if (!takeValue(argc, argv, i, args.data_dir)) return 1;\n    } else if (std::strcmp(a, \"--no-vipc\") == 0) {\n      args.no_vipc = true;\n    } else if (std::strcmp(a, \"--dbc\") == 0) {\n      if (!takeValue(argc, argv, i, args.dbc)) return 1;\n    } else if (a[0] == '-') {\n      fprintf(stderr, \"error: unknown option %s\\n\", a);\n      printUsage(argv[0]);\n      return 1;\n    } else if (args.route.empty()) {\n      args.route = a;\n    } else {\n      fprintf(stderr, \"error: unexpected argument %s\\n\", a);\n      printUsage(argv[0]);\n      return 1;\n    }\n  }\n  ok = true;\n  return 0;\n}\n\n}  // namespace\n\nint main(int argc, char *argv[]) {\n  QCoreApplication::setApplicationName(\"Cabana\");\n  initApp(argc, argv, false);\n  QApplication app(argc, argv);\n  app.setApplicationDisplayName(\"Cabana\");\n  //app.setWindowIcon(QIcon(\":cabana-icon.png\"));  // TODO: do this in imgui\n\n  UnixSignalHandler signalHandler;","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/commaai/openpilot/blob/516ec1e68203439a73f340f1d0b3b91eabc626ee/openpilot/tools/cabana/cabana.cc#L101-L137","documentation":"Printed by cabana's parseArgs for a non-option positional argument when the route has already been set — cabana accepts exactly one positional (the route). The second bare argument fails on the `a[0] == '-'` chain's final else; usage is printed and the process exits 1.","triggerScenarios":"Running `cabana ROUTE1 ROUTE2`, or an unquoted route string with spaces splitting into two argv entries (e.g. 'a b--/2'), or a trailing stray word after the route.","commonSituations":"Unquoted route names containing spaces or special shell characters, shell glob expansion producing multiple tokens, or attempts to open multiple routes at once which cabana does not support.","solutions":["Quote the route: cabana \"abcdef--/2\" so it stays one argument.","Pass only one route per invocation; run cabana again for the next route.","Remove stray trailing arguments (accidentally pasted text, empty-but-split variables)."],"exampleFix":"# before\ncabana my route --/2        # 'route --/2' -> unexpected argument\n\n# after\ncabana \"my route --/2\"","handlingStrategy":"validation","validationCode":"positionals = [a for a in sys.argv[1:] if not a.startswith('-')]\nif len(positionals) > 1:\n    raise SystemExit('cabana takes exactly one route argument')\nsubprocess.run(['cabana', *sys.argv[1:]])","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Quote route identifiers containing spaces or special characters.","Pass exactly one route per cabana invocation."],"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"}