nwjs/nw.js · critical · Exception
Patch config file %s does not exist.
Error message
Patch config file %s does not exist.
What it means
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.
Source
Thrown at tools/patcher.py:57
patch_dir = src_dir
else:
if not os.path.isabs(patch_dir):
# Apply patch relative to the Chromium 'src' directory.
patch_dir = os.path.join(src_dir, patch_dir)
patch_dir = os.path.abspath(patch_dir)
result = git_apply_patch_file(patch_path, patch_dir)
if result == 'fail':
write_note('ERROR',
'This patch failed to apply. Your build will not be correct.')
return result
def apply_patch_config():
''' Apply patch files based on a configuration file. '''
config_file = os.path.join(nw_patch_dir, 'patch.cfg')
if not os.path.isfile(config_file):
raise Exception('Patch config file %s does not exist.' % config_file)
# Parse the configuration file.
scope = {}
with open(config_file) as f:
exec(compile(f.read(), config_file, 'exec'), scope)
patches = scope["patches"]
results = {'apply': 0, 'skip': 0, 'fail': 0}
for patch in patches:
patch_file = patch['name']
dopatch = True
if 'condition' in patch:
# Check that the environment variable is set.
if patch['condition'] not in os.environ:
sys.stdout.write('\nSkipping patch file %s\n' % patch_file)
dopatch = FalseView on GitHub (pinned to e15da848e9)
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.
Defensive patterns
Strategy: validation
Validate before calling
import os
cfg = os.path.join(nw_patch_dir, 'patch.cfg')
if not os.path.isfile(cfg):
raise SystemExit('Missing %s — run the repo sync to restore the patch folder.' % cfg) Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- %d patches failed to apply. Your build will not be correct.
- Invaild parameter, need Shortcut object.
- It's forbidden to instantialize a Base class.
- Type of '{type}' is not supported
- Only support getting plain text from Clipboard
AI-assisted analysis of nwjs/nw.js@e15da848e9 (2026-08-13).
Data as JSON: /api/errors/b3b6789392e620ec.
Report an issue: GitHub.