commaai/openpilot · error · Exception
invalid build metadata
Error message
invalid build metadata
What it means
get_build_metadata raises when neither a prebuilt build metadata file (BUILD_METADATA_FILENAME, e.g. githash / release JSON in the checkout root) nor a .git folder exists at the given path. openpilot can only describe itself from a release artifact or a git checkout; with neither, metadata is undeterminable.
Source
Thrown at openpilot/common/version.py:156
if build_metadata_path.exists():
build_metadata = json.loads(build_metadata_path.read_text())
return build_metadata_from_dict(build_metadata)
git_folder = pathlib.Path(path) / ".git"
if git_folder.exists():
return BuildMetadata(get_short_branch(path),
OpenpilotMetadata(
version=get_version(path),
release_notes=get_release_notes(path),
git_commit=get_commit(path),
git_origin=get_origin(path),
git_commit_date=get_commit_date(path),
build_style="unknown",
is_dirty=is_dirty(path)))
cloudlog.exception("unable to get build metadata")
raise Exception("invalid build metadata")
if __name__ == "__main__":
print(get_build_metadata())
View on GitHub (pinned to 516ec1e682)
Solutions
- Run from a proper git clone of openpilot (restores the .git branch)
- Or run from an installed release checkout, which ships the prebuilt metadata file
- Verify the path passed/derived (e.g. BASEDIR) actually contains .git or the metadata file
Example fix
// before
md = get_build_metadata('/tmp/openpilot-copy')
// after
import pathlib
path = '/tmp/openpilot-copy'
assert (pathlib.Path(path) / '.git').exists() or (pathlib.Path(path) / 'githash').exists(), 'run from a git checkout or release'
md = get_build_metadata(path) Defensive patterns
Strategy: validation
Validate before calling
import pathlib
from openpilot.common.version import get_build_metadata, BUILD_METADATA_FILENAME
def build_metadata_available(path: str) -> bool:
p = pathlib.Path(path)
return (p / BUILD_METADATA_FILENAME).exists() or (p / '.git').exists() Prevention
- Run openpilot from a git clone or an installed release, never from ad-hoc source copies
- Ship the build metadata file in CI artifacts so stripped deployments still work
When it happens
Trigger: Calling get_build_metadata(path) on a source export created via 'git archive' or a tarball copy (no .git, no generated metadata file), or pointing path at a directory that is neither a checkout nor a release.
Common situations: Running openpilot code from a stripped-down copy, CI copying only sources without the release build step, or an incorrect BASEDIR (running from a different directory than the installed release).
Related errors
- no product string in wrapped firmware
- Unexpected non-vendored library '{name}'
- {t} is {size / (1024 * 1024):.1f} MiB, exceeding the {limit
AI-assisted analysis of commaai/openpilot@516ec1e682 (2026-08-15).
Data as JSON: /api/errors/480ac5719494ea48.
Report an issue: GitHub.