nodejs/node · error · ValueError

Found multiple children with path ${child_path}

Error message

Found multiple children with path ${child_path}

What it means

Raised by PBXGroup._AddChildToDicts when a child element (a file, group, or reference) being added to an Xcode group has the same source-tree-relative path as an existing child in that group. Xcode groups enforce path uniqueness among direct children; duplicates would corrupt the generated .pbxproj. This is a structural integrity check during .xcodeproj generation from gyp.

Source

Thrown at tools/gyp/pylib/gyp/xcodeproj_file.py:1208

        # children.
        for child in self._properties.get("children", []):
            child_name = child.Name()
            if child_name is not None:
                hashables.append(child_name)

        return hashables

    def HashablesForChild(self):
        # To avoid a circular reference the hashables used to compute a child id do
        # not include the child names.
        return XCHierarchicalElement.Hashables(self)

    def _AddChildToDicts(self, child):
        # Sets up this PBXGroup object's dicts to reference the child properly.
        child_path = child.PathFromSourceTreeAndPath()
        if child_path:
            if child_path in self._children_by_path:
                raise ValueError("Found multiple children with path " + child_path)
            self._children_by_path[child_path] = child

        if isinstance(child, PBXVariantGroup):
            child_name = child._properties.get("name", None)
            key = (child_name, child_path)
            if key in self._variant_children_by_name_and_path:
                raise ValueError(
                    "Found multiple PBXVariantGroup children with "
                    + "name "
                    + str(child_name)
                    + " and path "
                    + str(child_path)
                )
            self._variant_children_by_name_and_path[key] = child

    def AppendChild(self, child):
        # Callers should use this instead of calling
        # AppendProperty('children', child) directly because this function

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Search the target's 'sources' (and other file lists) for duplicate paths and remove the duplicates.
  2. Check that glob patterns in sources do not overlap, producing the same file from multiple patterns.
  3. Verify that source-tree-relative paths are unique within each Xcode group in the .gyp file.
  4. If the same file must be referenced in multiple targets, ensure each is a separate group/target, not the same group.

Example fix

# before
'sources': ['src/foo.c', 'src/foo.c']
# after
'sources': ['src/foo.c']
Defensive patterns

Strategy: validation

Validate before calling

# Deduplicate source paths before generation
sources = list(dict.fromkeys(target.get('sources', [])))  # preserve order, drop dups
if len(sources) != len(target.get('sources', [])):
    print('warning: duplicate sources removed')

Prevention

When it happens

Trigger: AppendChild(child) is called on a PBXGroup that already contains an entry with the same PathFromSourceTreeAndPath() value. Typically two source files or sub-groups with identical paths are added to the same group in the gyp target definition.

Common situations: A gyp target lists the same source file twice under 'sources'. Two groups or file references resolve to the same path. A glob pattern in sources matching overlapping files. Duplicated entries in a resources or frameworks list.

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/4b0d8f7d9a1dcd2f. Report an issue: GitHub.