{"record":{"id":"d04fe2f230bed2f7","repo":"commaai/openpilot","slug":"t-is-size-1024-1024-1f-mib-exceeding-t","errorCode":null,"errorMessage":"{t} is {size / (1024 * 1024):.1f} MiB, exceeding the {limit / (1024 * 1024):.1f} MiB limit","messagePattern":"(.+?) is (.+?) MiB, exceeding the (.+?) MiB limit","errorType":"exception","errorClass":"SCons.Errors.UserError","httpStatus":null,"severity":"error","filePath":"SConstruct","lineNumber":347,"sourceCode":"def progress_function(node):\n  global progress_count\n  if progress_count >= progress_total:\n    return\n  progress_count = min(progress_count + progress_interval, progress_total)\n  progress = round(100. * progress_count / progress_total, 1)\n  sys.stderr.write(\"\\rBuilding: %5.1f%%\" % progress if sys.stderr.isatty() else \"progress: %.1f\\n\" % progress)\n  if progress == 100. and sys.stderr.isatty():\n    sys.stderr.write(\"\\n\")\n  sys.stderr.flush()\n\nProgress(progress_function, interval=progress_interval)\nAddPostAction(BUILD_TARGETS or [Dir('.')], prune_cache_dir)\n\ndef check_build_product_size(target, source, env):\n  limit = 50 * 1024 * 1024  # GitHub max size\n  for t in target:\n    if hasattr(t, 'isfile') and t.isfile() and (size := os.path.getsize(t.abspath)) > limit:\n      raise SCons.Errors.UserError(f\"{t} is {size / (1024 * 1024):.1f} MiB, exceeding the {limit / (1024 * 1024):.1f} MiB limit\")\nif not GetOption('extras'):\n  AddPostAction(list(build_product_nodes), Action(check_build_product_size, None))\n","sourceCodeStart":329,"sourceCodeEnd":350,"githubUrl":"https://github.com/commaai/openpilot/blob/516ec1e68203439a73f340f1d0b3b91eabc626ee/SConstruct#L329-L350","documentation":"Raised by check_build_product_size, a SCons post-action on build products, when any produced file exceeds 50 MiB — the GitHub release asset upload cap that the comment cites. It aborts the build at the moment the oversized artifact appears, so a fat binary (usually with accidentally embedded debug info or a large static asset) cannot slip into a release.","triggerScenarios":"Any build product node (when not building with --extras) whose on-disk size passes 50 MiB: e.g. a release binary linked with -g or unstripped symbols, a bundled model/asset that grew past the cap, or duplicated static data linked into multiple products.","commonSituations":"Someone enables debug symbols or ASAN in a flag set used for release products; a new large model or firmware blob gets embedded; a linker config change stops stripping dead sections. CI release builds fail at the very end, after all compilation work.","solutions":["Strip the binary in the link step (add -s or run strip via a post-action on that target) — debug info is the usual >50 MiB culprit.","Check what bloated it: `size` / `nm --size-sort` / `objdump -h` on the artifact to find dominant symbols or sections.","Move large assets out of the binary and into a separate downloaded resource so the executable stays under the cap.","If you are intentionally building non-release/extras artifacts, build with scons --extras which skips this check (per `if not GetOption('extras')`)."],"exampleFix":"# before\nenv.Program('manager', objects)  # unstripped, >50MiB -> post-action UserError\n\n# after\nenv.Program('manager', objects, LINKFLAGS=['-s'])  # stripped, under GitHub cap","handlingStrategy":"validation","validationCode":"# pre-link estimate: fail fast before a long build\nimport os, subprocess\nsize = os.path.getsize(str(node)) if os.path.exists(str(node)) else 0\nassert size <= 50 * 1024 * 1024, f'{node} would exceed the 50 MiB release cap'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Strip release binaries (LINKFLAGS=['-s'] or a strip post-action) by default.","Keep large assets external to executables.","Build non-release artifacts with --extras to bypass the check intentionally."],"tags":["build","scons","artifact-size","release","openpilot"],"backgroundTag":null,"analyzedSha":"516ec1e68203439a73f340f1d0b3b91eabc626ee","analyzedAt":"2026-08-15T00:17:37.461Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}