gorhill/uBlock · error · SystemExit
Build dir missing.
Error message
Build dir missing.
What it means
make-firefox-meta.py is a build-time post-processor for the Firefox manifest. It requires exactly one CLI argument: the build directory holding manifest.json (opened at lines 19-21, later conditionally stripping sidebar_action at lines 23-30). If argv has no argument or an empty-string argument it aborts via SystemExit before doing anything (lines 8-9), because there is no manifest file to read or write.
Source
Thrown at tools/make-firefox-meta.py:9
#!/usr/bin/env python3
import os
import json
import re
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()
firefox_manifest = {}
firefox_manifest_file = os.path.join(build_dir, 'manifest.json')
with open(firefox_manifest_file) as f2:
firefox_manifest = json.load(f2)
if 'sidebar_action' in firefox_manifest:
match = re.search(r'^(\d+\.\d+\.\d+)(\.\d+)$', version)
if not match:
# https://bugzilla.mozilla.org/show_bug.cgi?id=1459007
# By design Firefox opens the sidebar with new installation ofView on GitHub (pinned to c68df492fd)
Solutions
- Invoke as `python tools/make-firefox-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-firefox-meta.py # SystemExit: Build dir missing. # after python tools/make-firefox-meta.py build/firefox
Defensive patterns
Strategy: validation
Validate before calling
import sys
if len(sys.argv) < 2 or not sys.argv[1].strip():
raise SystemExit('Usage: make-firefox-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-firefox-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/00a2b074000ef58c.
Report an issue: GitHub.