{"record":{"id":"968dd60966c77c1b","repo":"nodejs/node","slug":"missing-input-files-n-s","errorCode":null,"errorMessage":"Missing input files:\\n%s","messagePattern":"Missing input files:\\\\n(.+?)","errorType":"exception","errorClass":"GypError","httpStatus":null,"severity":"warning","filePath":"tools/gyp/pylib/gyp/generator/msvs.py","lineNumber":2164,"sourceCode":"        sln_projects += gyp.common.DeepDependencyTargets(target_dicts, sln_projects)\n        # Create folder hierarchy.\n        root_entries = _GatherSolutionFolders(\n            sln_projects, project_objects, flat=msvs_version.FlatSolution()\n        )\n        # Create solution.\n        sln = MSVSNew.MSVSSolution(\n            sln_path,\n            entries=root_entries,\n            variants=target_only_configs,\n            websiteProperties=False,\n            version=msvs_version,\n        )\n        sln.Write()\n\n    if missing_sources:\n        error_message = \"Missing input files:\\n\" + \"\\n\".join(set(missing_sources))\n        if generator_flags.get(\"msvs_error_on_missing_sources\", False):\n            raise GypError(error_message)\n        else:\n            print(\"Warning: \" + error_message, file=sys.stdout)\n\n\ndef _GenerateMSBuildFiltersFile(\n    filters_path,\n    source_files,\n    rule_dependencies,\n    extension_to_rule_name,\n    platforms,\n    toolset,\n):\n    \"\"\"Generate the filters file.\n\n    This file is used by Visual Studio to organize the presentation of source\n    files into folders.\n\n    Arguments:","sourceCodeStart":2146,"sourceCodeEnd":2182,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/tools/gyp/pylib/gyp/generator/msvs.py#L2146-L2182","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure all referenced source files exist on disk at generation time (run codegen, fix paths, restore deleted files).","Gate platform-specific or generated sources with conditions so they are only listed when present.","If missing sources are expected/acceptable, do not enable msvs_error_on_missing_sources (it defaults to a warning).","Update the .gyp sources list to remove references to deleted files."],"exampleFix":"// before\n'sources': ['gen/output.cc']  // not generated yet\n// after — generate first, or guard\n'conditions': [\n  ['generate_output==1', { 'sources': ['gen/output.cc'] }]\n]","handlingStrategy":"validation","validationCode":"import os\nmissing = [s for s in spec.get('sources', []) if not os.path.exists(s)]\nif missing:\n    print('warning: missing sources:', missing)","typeGuard":"import os\ndef all_sources_exist(spec) -> bool:\n    return all(os.path.exists(s) for s in spec.get('sources', []))","tryCatchPattern":"try:\n    GenerateOutput(...)\nexcept GypError as e:\n    if 'Missing input files' in str(e):\n        run_codegen_step(); regenerate()\n    raise","preventionTips":["Run codegen before gyp generation so generated sources exist.","Guard platform-specific sources with conditions.","Leave msvs_error_on_missing_sources off unless you want a hard failure."],"tags":["gyp","msvs","missing-sources","windows","filesystem"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}