{"record":{"id":"f8716bddf749ff7e","repo":"nodejs/node","slug":"found-multiple-pbxvariantgroup-children-with-name","errorCode":null,"errorMessage":"Found multiple PBXVariantGroup children with name ${child_name} and path ${child_path}","messagePattern":"Found multiple PBXVariantGroup children with name (.+?) and path (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/gyp/pylib/gyp/xcodeproj_file.py","lineNumber":1215,"sourceCode":"\n    def HashablesForChild(self):\n        # To avoid a circular reference the hashables used to compute a child id do\n        # not include the child names.\n        return XCHierarchicalElement.Hashables(self)\n\n    def _AddChildToDicts(self, child):\n        # Sets up this PBXGroup object's dicts to reference the child properly.\n        child_path = child.PathFromSourceTreeAndPath()\n        if child_path:\n            if child_path in self._children_by_path:\n                raise ValueError(\"Found multiple children with path \" + child_path)\n            self._children_by_path[child_path] = child\n\n        if isinstance(child, PBXVariantGroup):\n            child_name = child._properties.get(\"name\", None)\n            key = (child_name, child_path)\n            if key in self._variant_children_by_name_and_path:\n                raise ValueError(\n                    \"Found multiple PBXVariantGroup children with \"\n                    + \"name \"\n                    + str(child_name)\n                    + \" and path \"\n                    + str(child_path)\n                )\n            self._variant_children_by_name_and_path[key] = child\n\n    def AppendChild(self, child):\n        # Callers should use this instead of calling\n        # AppendProperty('children', child) directly because this function\n        # maintains the group's dicts.\n        self.AppendProperty(\"children\", child)\n        self._AddChildToDicts(child)\n\n    def GetChildByName(self, name):\n        # This is not currently optimized with a dict as GetChildByPath is because\n        # it has few callers.  Most callers probably want GetChildByPath.  This","sourceCodeStart":1197,"sourceCodeEnd":1233,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/tools/gyp/pylib/gyp/xcodeproj_file.py#L1197-L1233","documentation":"Raised by PBXGroup._AddChildToDicts when a PBXVariantGroup (used for localizations, e.g. .lproj variants) being added has the same (name, path) combination as an existing PBXVariantGroup child. Variant groups represent localized resources and must be uniquely identified within a group by their name and path.","triggerScenarios":"AppendChild is called with a PBXVariantGroup whose _properties['name'] and child_path match an existing entry in _variant_children_by_name_and_path. Two localization variant groups with the same name are added to the same parent group.","commonSituations":"Duplicate localized resource entries (e.g. two Localizable.strings variant groups) defined in the gyp config. A resources list that includes the same variant group twice. Misconfigured mac_bundle_resources or similar with overlapping localizations.","solutions":["Find the duplicate PBXVariantGroup entry in the gyp target's resource lists and remove it.","Ensure each localization variant group has a unique name within its parent group.","Consolidate multiple .lproj references into a single variant group rather than adding separate groups."],"exampleFix":"# before\n'mac_bundle_resources': [\n  'en.lproj/Localizable.strings',\n  'fr.lproj/Localizable.strings',\n]\n# (if these produce duplicate variant group names) merge into one variant group\n# after — ensure the gyp config declares one variant group for the base name\n'mac_bundle_resources': [\n  '<(PRODUCT_NAME)/Localizable.strings',\n]","handlingStrategy":"validation","validationCode":"# Ensure localization variant group names are unique within a group\nseen = set()\nfor res in resources:\n    name = os.path.splitext(os.path.basename(res))[0]\n    if name in seen:\n        raise ValueError(f'duplicate variant group name: {name}')\n    seen.add(name)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Merge per-language files into single variant groups rather than separate groups.","Audit mac_bundle_resources for duplicate base names across .lproj directories."],"tags":["xcode","gyp","xcodeproj","localization","duplicate"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}