{"record":{"id":"39b76e55bc4bcb86","repo":"commaai/openpilot","slug":"maximum-retries-exceeded","errorCode":null,"errorMessage":"Maximum retries exceeded","messagePattern":"Maximum retries exceeded","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"critical","filePath":"openpilot/common/hardware/comma/agnos.py","lineNumber":249,"sourceCode":"  subprocess.run(f\"abctl --set_unbootable {target_slot_number}\", shell=True)\n\n  for partition in update:\n    success = False\n\n    for retries in range(10):\n      try:\n        flash_partition(target_slot_number, partition, cloudlog, standalone)\n        success = True\n        break\n\n      except requests.exceptions.RequestException:\n        cloudlog.exception(\"Failed\")\n        cloudlog.info(f\"Failed to download {partition['name']}, retrying ({retries})\")\n        time.sleep(10)\n\n    if not success:\n      cloudlog.info(f\"Failed to flash {partition['name']}, aborting\")\n      raise Exception(\"Maximum retries exceeded\")\n\n  cloudlog.info(f\"AGNOS ready on slot {target_slot_number}\")\n\n\ndef verify_agnos_update(manifest_path: str, target_slot_number: int) -> bool:\n  update = json.load(open(manifest_path))\n  return all(verify_partition(target_slot_number, partition) for partition in update)\n\n\nif __name__ == \"__main__\":\n  import argparse\n  import logging\n\n  parser = argparse.ArgumentParser(description=\"Flash and verify AGNOS update\",\n                                   formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n\n  parser.add_argument(\"--verify\", action=\"store_true\", help=\"Verify and perform swap if update ready\")\n  parser.add_argument(\"--swap\", action=\"store_true\", help=\"Verify and perform swap, downloads if necessary\")","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/commaai/openpilot/blob/516ec1e68203439a73f340f1d0b3b91eabc626ee/openpilot/common/hardware/comma/agnos.py#L231-L267","documentation":"The AGNOS flash loop retries each partition on requests.exceptions.RequestException; after the retry budget is exhausted without success it raises 'Maximum retries exceeded', aborting the whole update. It indicates persistent network failure downloading firmware partitions.","triggerScenarios":"Repeated RequestException (connection errors, timeouts, HTTP failures) while downloading every retry attempt of a partition in flash_agnos_update.","commonSituations":"Device offline or on a dead Wi-Fi link; AGNOS server/CDN unreachable; DNS broken on the device; captive portal intercepting.","solutions":["Verify network connectivity and DNS on the device, then rerun the AGNOS update","Check the AGNOS manifest URL is reachable (curl it manually)","Move to a stable network — large partitions fail repeatedly on weak links"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"import socket\n\ndef agnos_endpoint_reachable(url: str) -> bool:\n    try:\n        requests.head(url, timeout=5)\n        return True\n    except requests.RequestException:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    flash_agnos_update(manifest)\nexcept Exception as e:\n    if \"Maximum retries exceeded\" in str(e):\n        alert_operator_network_failure()","preventionTips":["Verify DNS and connectivity before starting a multi-GB firmware update","Run firmware updates on wired/stable networks only"],"tags":["firmware","agnos","network","retries"],"backgroundTag":null,"analyzedSha":"516ec1e68203439a73f340f1d0b3b91eabc626ee","analyzedAt":"2026-08-15T00:17:37.461Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}