gorhill/uBlock · error · SystemExit
Build dir missing.
Error message
Build dir missing.
What it means
make-opera-meta.py is a build-time post-processor for the Opera manifest. It requires exactly one CLI argument: the build directory holding manifest.json (opened at lines 18-20). If argv has no argument or an empty-string argument it aborts via SystemExit before any work (lines 7-8), because there is no manifest file to read from or write the version back to.
Source
Thrown at tools/make-opera-meta.py:8
#!/usr/bin/env python3
import os
import json
import sys
if len(sys.argv) == 1 or not sys.argv[1]:
raise SystemExit('Build dir missing.')
proj_dir = os.path.join(os.path.split(os.path.abspath(__file__))[0], '..')
build_dir = os.path.abspath(sys.argv[1])
version = ''
with open(os.path.join(proj_dir, 'dist', 'version')) as f:
version = f.read().strip()
manifest_out = {}
manifest_out_file = os.path.join(build_dir, 'manifest.json')
with open(manifest_out_file) as f:
manifest_out = json.load(f)
manifest_out['version'] = version
with open(manifest_out_file, 'w') as f2:
json.dump(manifest_out, f2, indent=2, separators=(',', ': '), sort_keys=True)
f2.write('\n')View on GitHub (pinned to c68df492fd)
Solutions
- Invoke as `python tools/make-opera-meta.py <build_dir>` where <build_dir> holds the built manifest.json.
- Run through the project's normal build tooling (npm scripts) which supplies the argument correctly.
- If wrapping the script, assert the build-dir argument is non-empty before invoking it.
Example fix
# before python tools/make-opera-meta.py # SystemExit: Build dir missing. # after python tools/make-opera-meta.py build/opera
Defensive patterns
Strategy: validation
Validate before calling
import sys
if len(sys.argv) < 2 or not sys.argv[1].strip():
raise SystemExit('Usage: make-opera-meta.py <build_dir>')
build_dir = sys.argv[1] Prevention
- Pass the build output directory as the first argument every time.
- Invoke through the project's npm scripts rather than running the .py directly.
- If wrapping the script, fail fast with a clear usage message when the arg is missing.
- Verify the manifest.json exists under the given build dir before proceeding.
When it happens
Trigger: Running `python tools/make-opera-meta.py` with no argument or an empty-string argument. Invoking it through a wrapper or make target whose build-dir variable was left unset or expanded to empty.
Common situations: Running the script manually during local packaging without passing the build output dir; a Makefile/npm script with an empty $(BUILD_DIR) placeholder; copy-pasting the command and dropping the trailing path argument.
Related errors
AI-assisted analysis of gorhill/uBlock@c68df492fd (2026-08-12).
Data as JSON: /api/errors/ceb7cbda4862d58b.
Report an issue: GitHub.