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 = False

View on GitHub (pinned to e15da848e9)

Solutions

  1. Ensure the patch/ directory exists at the NW.js root and contains patch.cfg: run git status / git log on the patch folder.
  2. Re-run the repository sync (gclient sync / the project's deps script) to restore missing files.
  3. 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

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


AI-assisted analysis of nwjs/nw.js@e15da848e9 (2026-08-13). Data as JSON: /api/errors/b3b6789392e620ec. Report an issue: GitHub.