{"record":{"id":"ff05db291c1d1acf","repo":"nodejs/node","slug":"can-t-use-path-path-in-a-self-class-name","errorCode":null,"errorMessage":"Can't use path {path} in a {self.__class__.__name__}","messagePattern":"Can't use path (.+?) in a (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/gyp/pylib/gyp/xcodeproj_file.py","lineNumber":2179,"sourceCode":"                            )\n                    else:\n                        # subfolder = 16 from above\n                        # The second element of the path is an unrecognized variable.\n                        # Include it and any remaining elements in relative_path.\n                        relative_path = path_tree_match.group(3)\n\n            else:\n                # The path starts with an unrecognized Xcode variable\n                # name like $(SRCROOT).  Xcode will still handle this\n                # as an \"absolute path\" that starts with the variable.\n                subfolder = 0\n                relative_path = path\n        elif path.startswith(\"/\"):\n            # Special case.  Absolute paths are in dstSubfolderSpec 0.\n            subfolder = 0\n            relative_path = path[1:]\n        else:\n            raise ValueError(f\"Can't use path {path} in a {self.__class__.__name__}\")\n\n        self._properties[\"dstPath\"] = relative_path\n        self._properties[\"dstSubfolderSpec\"] = subfolder\n\n\nclass PBXBuildRule(XCObject):\n    _schema = XCObject._schema.copy()\n    _schema.update(\n        {\n            \"compilerSpec\": [0, str, 0, 1],\n            \"filePatterns\": [0, str, 0, 0],\n            \"fileType\": [0, str, 0, 1],\n            \"isEditable\": [0, int, 0, 1, 1],\n            \"outputFiles\": [1, str, 0, 1, []],\n            \"script\": [0, str, 0, 0],\n        }\n    )\n","sourceCodeStart":2161,"sourceCodeEnd":2197,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/tools/gyp/pylib/gyp/xcodeproj_file.py#L2161-L2197","documentation":"Raised by the path-parsing logic in a PBXCopyFilesBuildPhase (copy-files / resources copy phase) when a destination path does not match any recognized pattern: it is not an absolute path (starting with '/'), does not start with a known Xcode variable like $(DEVELOPER_RESOURCES), $(HOME), $(SDKROOT), $(SRCROOT), or $(BUILT_PRODUCTS_DIR). A bare relative path is not valid for a copy-files destination, so the code raises ValueError rather than silently misplacing the file.","triggerScenarios":"SetDstPath or equivalent is called with a relative path string like 'subdir/file' or 'foo' that doesn't begin with '/' or a recognized $(...) variable prefix. The path falls through all the elif branches to the final else.","commonSituations":"Specifying a relative destination path for a copy-files build phase in gyp config. Using a non-standard Xcode variable name. A typo in the variable syntax (e.g. '$SRCROOT' instead of '$(SRCROOT)').","solutions":["Use an absolute path or a recognized Xcode variable: $(SRCROOT), $(BUILT_PRODUCTS_DIR), $(HOME), $(SDKROOT), $(DEVELOPER_RESOURCES).","Prefix the path with $(SRCROOT)/ to anchor a source-tree-relative destination.","Check variable syntax: Xcode uses $(VAR_NAME) form, not $VAR_NAME.","For copy resources into the bundle, prefer $(BUILT_PRODUCTS_DIR)/$(CONTENTS_FOLDER_PATH)."],"exampleFix":"# before\n'destination_path': 'Resources/icons'\n# after\n'destination_path': '$(SRCROOT)/Resources/icons'","handlingStrategy":"validation","validationCode":"# Validate copy-files destination path before assignment\nimport re\n_RECOGNIZED = re.compile(r'^(/|\\$\\((SRCROOT|BUILT_PRODUCTS_DIR|HOME|SDKROOT|DEVELOPER_RESOURCES|CONTENTS_FOLDER_PATH)\\))')\nif not _RECOGNIZED.match(path):\n    path = '$(SRCROOT)/' + path  # anchor relative paths","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always anchor copy-files destination paths with $(SRCROOT) or another Xcode variable.","Use $(VAR) syntax, not $VAR, for Xcode build variables."],"tags":["xcode","gyp","xcodeproj","copy-files","path"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}