nodejs/node · error · Exception
Missing input files: %s
Error message
Missing input files: %s
What it means
When generator_flags['msvs_error_on_missing_sources'] is set, gyp checks that every regular source file (those without a '$' special marker) exists on disk relative to the build dir. Missing files would cause unnecessary recompilation and confusing VS failures; this opt-in check surfaces them early with a normalized path list.
Source
Thrown at tools/gyp/pylib/gyp/msvs_emulation.py:1234
cl_paths[arch] = _ExtractCLPath(output)
return cl_paths
def VerifyMissingSources(sources, build_dir, generator_flags, gyp_to_ninja):
"""Emulate behavior of msvs_error_on_missing_sources present in the msvs
generator: Check that all regular source files, i.e. not created at run time,
exist on disk. Missing files cause needless recompilation when building via
VS, and we want this check to match for people/bots that build using ninja,
so they're not surprised when the VS build fails."""
if int(generator_flags.get("msvs_error_on_missing_sources", 0)):
no_specials = filter(lambda x: "$" not in x, sources)
relative = [os.path.join(build_dir, gyp_to_ninja(s)) for s in no_specials]
missing = [x for x in relative if not os.path.exists(x)]
if missing:
# They'll look like out\Release\..\..\stuff\things.cc, so normalize the
# path for a slightly less crazy looking output.
cleaned_up = [os.path.normpath(x) for x in missing]
raise Exception("Missing input files:\n%s" % "\n".join(cleaned_up))
# Sets some values in default_variables, which are required for many
# generators, run on Windows.
def CalculateCommonVariables(default_variables, params):
generator_flags = params.get("generator_flags", {})
# Set a variable so conditions can be based on msvs_version.
msvs_version = gyp.msvs_emulation.GetVSVersion(generator_flags)
default_variables["MSVS_VERSION"] = msvs_version.ShortName()
# To determine processor word size on Windows, in addition to checking
# PROCESSOR_ARCHITECTURE (which reflects the word size of the current
# process), it is also necessary to check PROCESSOR_ARCHITEW6432 (which
# contains the actual word size of the system when running thru WOW64).
if "64" in os.environ.get("PROCESSOR_ARCHITECTURE", "") or "64" in os.environ.get(
"PROCESSOR_ARCHITEW6432", ""
):View on GitHub (pinned to 1b2de5e052)
Solutions
- For each path in the error, verify whether the file should exist at that location.
- If it was removed/moved, delete or fix the entry in the .gyp 'sources' list.
- If it is a generated file, ensure the generator step runs before this check, or remove the flag for that build.
- If paths are relative, correct them so they resolve under the build directory.
Example fix
// before 'sources': ['src/removed.cc', 'src/main.cc'] // after 'sources': ['src/main.cc']
Defensive patterns
Strategy: validation
Validate before calling
import os
build_dir = '.'
for s in target_dict.get('sources', []):
if '$' in s:
continue
if not os.path.exists(os.path.normpath(os.path.join(build_dir, s))):
raise FileNotFoundError(f'missing source referenced by {target_dict.get("target_name")}: {s}') Type guard
def all_regular_sources_exist(target_dict: dict, build_dir: str) -> bool:
import os
for s in target_dict.get('sources', []):
if '$' in s:
continue
if not os.path.exists(os.path.normpath(os.path.join(build_dir, s))):
return False
return True Prevention
- Remove deleted files from .gyp sources immediately.
- Only enable msvs_error_on_missing_sources once all sources are stable.
- Ensure codegen steps that produce sources run before this check; mark generated sources with '$' where appropriate.
When it happens
Trigger: msvs_error_on_missing_sources is truthy in generator_flags and at least one entry in the target's sources resolves (after gyp_to_ninja and build_dir join) to a path that os.path.exists reports as missing.
Common situations: A source file was deleted or moved but not removed from the .gyp file; a generated source listed as a regular source but not yet produced; wrong relative path in sources; building before running a codegen step that creates the file.
Related errors
- AddFileConfig: file "%s" not in project.
- expected string; got %r
- expected string list; got %r
- expected bool; got %r
- index value (%d) not in expected range [0, %d)
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/33dae54d85edee5e.
Report an issue: GitHub.