{"record":{"id":"3de6370f18f4f4a0","repo":"commaai/openpilot","slug":"invalid-speed-group-see-help","errorCode":null,"errorMessage":"invalid speed group, see help","messagePattern":"invalid speed group, see help","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/car_porting/measure_steering_accuracy.py","lineNumber":34,"sourceCode":"class SteeringAccuracyTool:\n  all_groups = {\"germany\":  (45, \"45 - up m/s  //  162 - up km/h  //  101 - up mph\"),\n                \"veryfast\": (35, \"35 - 45 m/s  //  126 - 162 km/h  //  78 - 101 mph\"),\n                \"fast\":     (25, \"25 - 35 m/s  //  90 - 126 km/h  //  56 - 78 mph\"),\n                \"medium\":   (15, \"15 - 25 m/s  //  54 - 90 km/h  //  34 - 56 mph\"),\n                \"slow\":     (5,  \" 5 - 15 m/s  //  18 - 54 km/h  //  11 - 34 mph\"),\n                \"crawl\":    (0,  \" 0 - 5 m/s  //  0 - 18 km/h  //  0 - 11 mph\")}\n\n  def __init__(self, args):\n    self.msg_cnt = 0\n    self.cnt = 0\n    self.total_error = 0\n\n    if args.group == \"all\":\n      self.display_groups = self.all_groups.keys()\n    elif args.group in self.all_groups.keys():\n      self.display_groups = [args.group]\n    else:\n      raise ValueError(\"invalid speed group, see help\")\n\n    self.speed_group_stats = {}\n    for group in self.all_groups:\n      self.speed_group_stats[group] = defaultdict(lambda: {'err': 0, \"cnt\": 0, \"=\": 0, \"+\": 0, \"-\": 0, \"steer\": 0, \"limited\": 0, \"saturated\": 0, \"dpp\": 0})\n\n  def update(self, sm):\n    self.msg_cnt += 1\n\n    lateralControlState = sm['controlsState'].lateralControlState\n    control_type = list(lateralControlState.to_dict().keys())[0]\n    control_state = lateralControlState.__getattr__(control_type)\n\n    v_ego = sm['carState'].vEgo\n    active = sm['controlsState'].active\n    steer = sm['carOutput'].actuatorsOutput.torque\n    standstill = sm['carState'].standstill\n    steer_limited_by_safety = abs(sm['carControl'].actuators.torque - sm['carControl'].actuatorsOutput.torque) > 1e-2\n    overriding = sm['carState'].steeringPressed","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/commaai/openpilot/blob/516ec1e68203439a73f340f1d0b3b91eabc626ee/tools/car_porting/measure_steering_accuracy.py#L16-L52","documentation":"Raised by __init__ of the stats class in measure_steering_accuracy.py when the --group argument is neither 'all' nor one of the defined speed-group keys ('residential', '30-50mph', '70mph', 'crawl' per all_groups). It is a simple CLI argument validation error: the script could not map your group string to a speed bucket.","triggerScenarios":"Running measure_steering_accuracy.py --group <name> where <name> is misspelled (e.g. 'residental', '30-50', 'City') or omitted-but-defaulted to an invalid value. Valid choices are exactly the keys of all_groups plus the literal 'all'.","commonSituations":"Typos from memory instead of --help, using group names from an older version of the script whose buckets were renamed, or passing units ('mph') instead of the bucket key.","solutions":["Run the script with --help and copy a valid group name exactly (e.g. --group '30-50mph' with quotes).","Use --group all if you want all speed buckets instead of guessing a name.","Check the all_groups dict at the top of tools/car_porting/measure_steering_accuracy.py for the exact accepted keys in your checkout."],"exampleFix":"# before\npython tools/car_porting/measure_steering_accuracy.py --group residential2\n\n# after\npython tools/car_porting/measure_steering_accuracy.py --group all","handlingStrategy":"validation","validationCode":"from tools.car_porting.measure_steering_accuracy import SpeedStats  # module containing all_groups\nvalid = set(SpeedStats.all_groups) | {'all'}\nif args.group not in valid:\n    raise SystemExit(f\"--group must be one of {sorted(valid)}\")","typeGuard":null,"tryCatchPattern":"try:\n    stats = SpeedStats(args)\nexcept ValueError as e:\n    if 'invalid speed group' in str(e):\n        print(f\"valid groups: {sorted(set(SpeedStats.all_groups) | {'all'})}\"); sys.exit(2)\n    raise","preventionTips":["Copy group names verbatim from --help or all_groups.","Use argparse choices= instead of manual validation in your own tools."],"tags":["cli","argument-validation","car-porting","openpilot"],"backgroundTag":null,"analyzedSha":"516ec1e68203439a73f340f1d0b3b91eabc626ee","analyzedAt":"2026-08-15T00:17:37.461Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}