{"record":{"id":"b3b6789392e620ec","repo":"nwjs/nw.js","slug":"patch-config-file-s-does-not-exist","errorCode":null,"errorMessage":"Patch config file %s does not exist.","messagePattern":"Patch config file (.+?) does not exist\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"critical","filePath":"tools/patcher.py","lineNumber":57,"sourceCode":"    patch_dir = src_dir\n  else:\n    if not os.path.isabs(patch_dir):\n      # Apply patch relative to the Chromium 'src' directory.\n      patch_dir = os.path.join(src_dir, patch_dir)\n    patch_dir = os.path.abspath(patch_dir)\n\n  result = git_apply_patch_file(patch_path, patch_dir)\n  if result == 'fail':\n    write_note('ERROR',\n               'This patch failed to apply. Your build will not be correct.')\n  return result\n\n\ndef apply_patch_config():\n  ''' Apply patch files based on a configuration file. '''\n  config_file = os.path.join(nw_patch_dir, 'patch.cfg')\n  if not os.path.isfile(config_file):\n    raise Exception('Patch config file %s does not exist.' % config_file)\n\n  # Parse the configuration file.\n  scope = {}\n  with open(config_file) as f:\n    exec(compile(f.read(), config_file, 'exec'), scope)\n  patches = scope[\"patches\"]\n\n  results = {'apply': 0, 'skip': 0, 'fail': 0}\n\n  for patch in patches:\n    patch_file = patch['name']\n    dopatch = True\n\n    if 'condition' in patch:\n      # Check that the environment variable is set.\n      if patch['condition'] not in os.environ:\n        sys.stdout.write('\\nSkipping patch file %s\\n' % patch_file)\n        dopatch = False","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/nwjs/nw.js/blob/e15da848e9e08e6e467532dae78995c6ad2f55ee/tools/patcher.py#L39-L75","documentation":"Raised by apply_patch_config() in tools/patcher.py when the file patch/patch.cfg does not exist in the NW.js patch directory. patch.cfg is the manifest that defines the list of patches to apply to the vendored Chromium source during a custom build. Without it the patcher cannot know which patches to run, so it aborts the build.","triggerScenarios":"Running tools/patcher.py when the nw 'patch' directory is missing or incomplete; building from a shallow/partial checkout that excluded the patch/ folder; pointing NW at a Chromium tree without having copied the patch configuration; running patcher from the wrong working directory so the relative path resolution fails.","commonSituations":"Fresh clone without submodules/deps; CI that does a sparse checkout; accidentally deleting or moving patch/patch.cfg; merging branches that dropped the patch config.","solutions":["Ensure the patch/ directory exists at the NW.js root and contains patch.cfg: run git status / git log on the patch folder.","Re-run the repository sync (gclient sync / the project's deps script) to restore missing files.","If patching is not needed for your workflow, invoke patcher with --patch-file to apply a single patch directly instead of relying on the config."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import os\n\ncfg = os.path.join(nw_patch_dir, 'patch.cfg')\nif not os.path.isfile(cfg):\n    raise SystemExit('Missing %s — run the repo sync to restore the patch folder.' % cfg)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure the patch/ directory and patch/patch.cfg are present before building.","Run the project's deps/sync script (gclient sync) on fresh clones.","Use --patch-file to apply a single patch directly if you do not need the full config."],"tags":["nwjs","build","patcher","config-missing","python"],"backgroundTag":null,"analyzedSha":"e15da848e9e08e6e467532dae78995c6ad2f55ee","analyzedAt":"2026-08-13T04:15:35.452Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}