nodejs/node · warning · GypError

Missing input files:\n

Error message

Missing input files:\n%s

What it means

Raised as a GypError (or printed as a warning) when MSVS generation completes but some source files referenced by targets do not exist on disk. The behavior depends on the msvs_error_on_missing_sources generator flag: if set, it is a hard error; otherwise it is a stdout warning. Missing sources produce broken Visual Studio projects.

Solutions

  1. Ensure all referenced source files exist on disk at generation time (run codegen, fix paths, restore deleted files).
  2. Gate platform-specific or generated sources with conditions so they are only listed when present.
  3. If missing sources are expected/acceptable, do not enable msvs_error_on_missing_sources (it defaults to a warning).
  4. Update the .gyp sources list to remove references to deleted files.

Example fix

// before
'sources': ['gen/output.cc']  // not generated yet
// after — generate first, or guard
'conditions': [
  ['generate_output==1', { 'sources': ['gen/output.cc'] }]
]
Defensive patterns

Strategy: validation

Validate before calling

import os
missing = [s for s in spec.get('sources', []) if not os.path.exists(s)]
if missing:
    print('warning: missing sources:', missing)

Type guard

import os
def all_sources_exist(spec) -> bool:
    return all(os.path.exists(s) for s in spec.get('sources', []))

Try / catch

try:
    GenerateOutput(...)
except GypError as e:
    if 'Missing input files' in str(e):
        run_codegen_step(); regenerate()
    raise

Prevention

When it happens

Trigger: A .gyp target lists source files that do not exist at generation time. After writing the .sln, the missing_sources collection is non-empty at msvs.py:2161 and, if generator_flags['msvs_error_on_missing_sources'] is True, GypError is raised.

Common situations: Sources generated by a prior build step that hasn't run yet; stale .gyp after files were renamed/deleted; glob patterns referencing directories that don't exist in the current checkout; cross-platform sources listed unconditionally.

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/968dd60966c77c1b. Report an issue: GitHub.

Appendix: source

Thrown at tools/gyp/pylib/gyp/generator/msvs.py:2164

        sln_projects += gyp.common.DeepDependencyTargets(target_dicts, sln_projects)
        # Create folder hierarchy.
        root_entries = _GatherSolutionFolders(
            sln_projects, project_objects, flat=msvs_version.FlatSolution()
        )
        # Create solution.
        sln = MSVSNew.MSVSSolution(
            sln_path,
            entries=root_entries,
            variants=target_only_configs,
            websiteProperties=False,
            version=msvs_version,
        )
        sln.Write()

    if missing_sources:
        error_message = "Missing input files:\n" + "\n".join(set(missing_sources))
        if generator_flags.get("msvs_error_on_missing_sources", False):
            raise GypError(error_message)
        else:
            print("Warning: " + error_message, file=sys.stdout)


def _GenerateMSBuildFiltersFile(
    filters_path,
    source_files,
    rule_dependencies,
    extension_to_rule_name,
    platforms,
    toolset,
):
    """Generate the filters file.

    This file is used by Visual Studio to organize the presentation of source
    files into folders.

    Arguments:

View on GitHub (pinned to 1b2de5e052)