{"record":{"id":"5a3fa888a935da0b","repo":"nodejs/node","slug":"must-specify-files-to-analyze-via-config-path-gene","errorCode":null,"errorMessage":"Must specify files to analyze via config_path generator flag","messagePattern":"Must specify files to analyze via config_path generator flag","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"tools/gyp/pylib/gyp/generator/analyzer.py","lineNumber":750,"sourceCode":"        print(\"Supplied test_targets & compile_targets\")\n        for target in supplied_targets:\n            print(\"\\t\", target.name)\n        print(\"Finding compile targets\")\n        compile_targets = _GetCompileTargets(self._changed_targets, supplied_targets)\n        return [\n            gyp.common.ParseQualifiedTarget(target.name)[1]\n            for target in compile_targets\n        ]\n\n\ndef GenerateOutput(target_list, target_dicts, data, params):\n    \"\"\"Called by gyp as the final stage. Outputs results.\"\"\"\n    config = Config()\n    try:\n        config.Init(params)\n\n        if not config.files:\n            raise Exception(\n                \"Must specify files to analyze via config_path generator flag\"\n            )\n\n        toplevel_dir = _ToGypPath(os.path.abspath(params[\"options\"].toplevel_dir))\n        if debug:\n            print(\"toplevel_dir\", toplevel_dir)\n\n        if _WasGypIncludeFileModified(params, config.files):\n            result_dict = {\n                \"status\": all_changed_string,\n                \"test_targets\": list(config.test_target_names),\n                \"compile_targets\": list(\n                    config.additional_compile_target_names | config.test_target_names\n                ),\n            }\n            _WriteOutput(params, **result_dict)\n            return\n","sourceCodeStart":732,"sourceCodeEnd":768,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/tools/gyp/pylib/gyp/generator/analyzer.py#L732-L768","documentation":"Thrown by the analyzer generator's GenerateOutput when the loaded config has no 'files' entry (or an empty one). The analyzer exists to determine which targets are affected by a set of changed files, so an empty file list is a fatal misuse rather than a no-op. It indicates the config_path file is structurally valid but missing the essential 'files' key.","triggerScenarios":"Calling gyp with the analyzer generator where the config JSON parses and is a dict, but either lacks a 'files' key or 'files' maps to an empty list. config.files defaults to [] via config.get('files', []) and the `if not config.files` check at analyzer.py:752 fires.","commonSituations":"Omitting the 'files' key in the config; an upstream tool that computes the changed-file list produced an empty set (e.g. a CI step with no diff); typo'd key like 'file' instead of 'files'.","solutions":["Ensure the config JSON includes a non-empty \"files\" array listing the changed source paths.","If the changed-file set is genuinely empty, skip invoking the analyzer generator entirely rather than passing an empty config.","Check the upstream tool that populates 'files' (git diff, etc.) actually produced output."],"exampleFix":"// before\n{\n  \"test_targets\": [\"foo\"],\n  \"additional_compile_targets\": []\n}\n// after\n{\n  \"files\": [\"src/foo.cc\"],\n  \"test_targets\": [\"foo\"],\n  \"additional_compile_targets\": []\n}","handlingStrategy":"validation","validationCode":"import json\nwith open('config.json') as f:\n    cfg = json.load(f)\nfiles = cfg.get('files', [])\nif not files:\n    raise SystemExit('config must contain a non-empty \"files\" array')","typeGuard":"def has_nonempty_files(cfg) -> bool:\n    return isinstance(cfg, dict) and isinstance(cfg.get('files'), list) and len(cfg['files']) > 0","tryCatchPattern":"try:\n    GenerateOutput(target_list, target_dicts, data, params)\nexcept Exception as e:\n    if 'Must specify files to analyze' in str(e):\n        skip_analyzer_run()\n    raise","preventionTips":["Skip the analyzer invocation entirely when the changed-file set is empty.","Validate the 'files' key is present and non-empty before running gyp."],"tags":["gyp","analyzer","config","required-field"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}