{"record":{"id":"e6fc94098867be4a","repo":"gorhill/uBlock","slug":"build-dir-missing","errorCode":null,"errorMessage":"Build dir missing.","messagePattern":"Build dir missing\\.","errorType":"exception","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"tools/make-chromium-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\nmanifest_out = {}\nmanifest_out_file = os.path.join(build_dir, 'manifest.json')\nwith open(manifest_out_file) as f:\n    manifest_out = json.load(f)\n\nmanifest_out['version'] = version\n\n# Development build? If so, modify name accordingly.\nmatch = re.search(r'^\\d+\\.\\d+\\.\\d+\\.\\d+$', version)\nif match:","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/gorhill/uBlock/blob/c68df492fd951bc3355fd0c6fec4afa8e2eae0aa/tools/make-chromium-meta.py#L1-L27","documentation":"make-chromium-meta.py is a build-time post-processor for the Chromium manifest. It requires exactly one CLI argument: the build directory that contains manifest.json (opened at lines 19-21). If argv has no argument or an empty-string argument it aborts via SystemExit before any work (lines 8-9), because there is no build directory to read from or write back to.","triggerScenarios":"Running `python tools/make-chromium-meta.py` with no argument, or with 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-chromium-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-chromium-meta.py        # SystemExit: Build dir missing.\n\n# after\npython tools/make-chromium-meta.py build/chromium","handlingStrategy":"validation","validationCode":"import sys\nif len(sys.argv) < 2 or not sys.argv[1].strip():\n    raise SystemExit('Usage: make-chromium-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","chromium"],"backgroundTag":null,"analyzedSha":"c68df492fd951bc3355fd0c6fec4afa8e2eae0aa","analyzedAt":"2026-08-12T23:57:11.071Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}