{"record":{"id":"981fc252d5c5da4e","repo":"nodejs/node","slug":"invalid-config-specified-via-build-s","errorCode":null,"errorMessage":"Invalid config specified via --build: %s","messagePattern":"Invalid config specified via --build: (.+?)","errorType":"exception","errorClass":"GypError","httpStatus":null,"severity":"error","filePath":"tools/gyp/pylib/gyp/__init__.py","lineNumber":685,"sourceCode":"            params,\n            options.check,\n            options.circular_check,\n        )\n\n        # TODO(mark): Pass |data| for now because the generator needs a list of\n        # build files that came in.  In the future, maybe it should just accept\n        # a list, and not the whole data dict.\n        # NOTE: flat_list is the flattened dependency graph specifying the order\n        # that targets may be built.  Build systems that operate serially or that\n        # need to have dependencies defined before dependents reference them should\n        # generate targets in the order specified in flat_list.\n        generator.GenerateOutput(flat_list, targets, data, params)\n\n        if options.configs:\n            valid_configs = targets[flat_list[0]][\"configurations\"]\n            for conf in options.configs:\n                if conf not in valid_configs:\n                    raise GypError(\"Invalid config specified via --build: %s\" % conf)\n            generator.PerformBuild(data, options.configs, params)\n\n    # Done\n    return 0\n\n\ndef main(args):\n    try:\n        return gyp_main(args)\n    except GypError as e:\n        sys.stderr.write(\"gyp: %s\\n\" % e)\n        return 1\n\n\n# NOTE: console_scripts calls this function with no arguments\ndef script_main():\n    return main(sys.argv[1:])\n","sourceCodeStart":667,"sourceCodeEnd":703,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/tools/gyp/pylib/gyp/__init__.py#L667-L703","documentation":"During the --build path (gyp actually drives a build, not just project generation), gyp raises GypError('Invalid config specified via --build: %s') when a configuration name passed via --build-configs/options.configs is not present in the first target's 'configurations' dict. valid_configs is taken from targets[flat_list[0]]['configurations'], so the check is anchored at the first build target's declared configs (e.g. 'Debug'/'Release').","triggerScenarios":"Running `gyp --build=Debug` when the target's .gyp only defines 'Release'; passing a config name with a typo; mixing configs across targets where the first target doesn't define the requested one.","commonSituations":"Renaming configurations in a .gyp without updating CI invocations; inheriting a gyp invocation from another project whose configs differ.","solutions":["Open the target's .gyp and use a configuration name that appears in its 'configurations' keys.","Add the missing configuration (e.g. 'Debug') to the target's configurations dict.","Drop the --build config argument to use the default configuration."],"exampleFix":"# before: .gyp defines only 'Release'\npython gyp --build=Debug project.gyp\n\n# after\npython gyp --build=Release project.gyp","handlingStrategy":"validation","validationCode":"def check_config_in_target(target_dict, config):\n    valid = set(target_dict.get('configurations', {}).keys())\n    if config not in valid:\n        raise ValueError('--build config %r not in %s' % (config, sorted(valid)))\n    return config","typeGuard":"def config_is_valid(target_dict, config: str) -> bool:\n    return config in target_dict.get('configurations', {})","tryCatchPattern":"try:\n    gyp_main(args)\nexcept GypError as e:\n    if 'Invalid config' in str(e):\n        # pick the first declared config as a safe default\n        args = [a for a in args if not a.startswith('--build=')] + ['--build=<first-config>']\n        raise","preventionTips":["Cross-check --build config names against the target's 'configurations' keys.","Keep configuration names consistent across all targets in a project.","Update CI invocations whenever .gyp configurations are renamed."],"tags":["gyp","build","configurations","validation","cli"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}