{"record":{"id":"00a2b074000ef58c","repo":"gorhill/uBlock","slug":"build-dir-missing-00a2b0","errorCode":null,"errorMessage":"Build dir missing.","messagePattern":"Build dir missing\\.","errorType":"exception","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"tools/make-firefox-meta.py","lineNumber":9,"sourceCode":"#!/usr/bin/env python3\n\nimport os\nimport json\nimport re\nimport sys\n\nif len(sys.argv) == 1 or not sys.argv[1]:\n    raise SystemExit('Build dir missing.')\n\nproj_dir = os.path.join(os.path.split(os.path.abspath(__file__))[0], '..')\nbuild_dir = os.path.abspath(sys.argv[1])\n\nversion = ''\nwith open(os.path.join(proj_dir, 'dist', 'version')) as f:\n    version = f.read().strip()\n\nfirefox_manifest = {}\nfirefox_manifest_file = os.path.join(build_dir, 'manifest.json')\nwith open(firefox_manifest_file) as f2:\n    firefox_manifest = json.load(f2)\n\nif 'sidebar_action' in firefox_manifest:\n    match = re.search(r'^(\\d+\\.\\d+\\.\\d+)(\\.\\d+)$', version)\n    if not match:\n        # https://bugzilla.mozilla.org/show_bug.cgi?id=1459007\n        # By design Firefox opens the sidebar with new installation of","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/gorhill/uBlock/blob/c68df492fd951bc3355fd0c6fec4afa8e2eae0aa/tools/make-firefox-meta.py#L1-L27","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\npython tools/make-firefox-meta.py        # SystemExit: Build dir missing.\n\n# after\npython tools/make-firefox-meta.py build/firefox","handlingStrategy":"validation","validationCode":"import sys\nif len(sys.argv) < 2 or not sys.argv[1].strip():\n    raise SystemExit('Usage: make-firefox-meta.py <build_dir>')\nbuild_dir = sys.argv[1]","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["build","cli","argv","firefox"],"backgroundTag":null,"analyzedSha":"c68df492fd951bc3355fd0c6fec4afa8e2eae0aa","analyzedAt":"2026-08-12T23:57:11.071Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}