commaai/openpilot · critical · Exception

Maximum retries exceeded

Error message

Maximum retries exceeded

What it means

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.

Source

Thrown at openpilot/common/hardware/comma/agnos.py:249

  subprocess.run(f"abctl --set_unbootable {target_slot_number}", shell=True)

  for partition in update:
    success = False

    for retries in range(10):
      try:
        flash_partition(target_slot_number, partition, cloudlog, standalone)
        success = True
        break

      except requests.exceptions.RequestException:
        cloudlog.exception("Failed")
        cloudlog.info(f"Failed to download {partition['name']}, retrying ({retries})")
        time.sleep(10)

    if not success:
      cloudlog.info(f"Failed to flash {partition['name']}, aborting")
      raise Exception("Maximum retries exceeded")

  cloudlog.info(f"AGNOS ready on slot {target_slot_number}")


def verify_agnos_update(manifest_path: str, target_slot_number: int) -> bool:
  update = json.load(open(manifest_path))
  return all(verify_partition(target_slot_number, partition) for partition in update)


if __name__ == "__main__":
  import argparse
  import logging

  parser = argparse.ArgumentParser(description="Flash and verify AGNOS update",
                                   formatter_class=argparse.ArgumentDefaultsHelpFormatter)

  parser.add_argument("--verify", action="store_true", help="Verify and perform swap if update ready")
  parser.add_argument("--swap", action="store_true", help="Verify and perform swap, downloads if necessary")

View on GitHub (pinned to 516ec1e682)

Solutions

  1. Verify network connectivity and DNS on the device, then rerun the AGNOS update
  2. Check the AGNOS manifest URL is reachable (curl it manually)
  3. Move to a stable network — large partitions fail repeatedly on weak links
Defensive patterns

Strategy: retry

Validate before calling

import socket

def agnos_endpoint_reachable(url: str) -> bool:
    try:
        requests.head(url, timeout=5)
        return True
    except requests.RequestException:
        return False

Try / catch

try:
    flash_agnos_update(manifest)
except Exception as e:
    if "Maximum retries exceeded" in str(e):
        alert_operator_network_failure()

Prevention

When it happens

Trigger: Repeated RequestException (connection errors, timeouts, HTTP failures) while downloading every retry attempt of a partition in flash_agnos_update.

Common situations: Device offline or on a dead Wi-Fi link; AGNOS server/CDN unreachable; DNS broken on the device; captive portal intercepting.

Related errors


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