{"record":{"id":"abe7a68fc9cb9b00","repo":"nodejs/node","slug":"cannot-handle-absolute-paths-got-s","errorCode":null,"errorMessage":"| cannot handle absolute paths, got \"%s\"","messagePattern":"\\| cannot handle absolute paths, got \"(.+?)\"","errorType":"exception","errorClass":"GypError","httpStatus":null,"severity":"error","filePath":"tools/gyp/pylib/gyp/input.py","lineNumber":877,"sourceCode":"            build_file_dir = os.path.dirname(build_file)\n            if build_file_dir == \"\" and not file_list:\n                # If build_file is just a leaf filename indicating a file in the\n                # current directory, build_file_dir might be an empty string.  Set\n                # it to None to signal to subprocess.Popen that it should run the\n                # command in the current directory.\n                build_file_dir = None\n\n        # Support <|(listfile.txt ...) which generates a file\n        # containing items from a gyp list, generated at gyp time.\n        # This works around actions/rules which have more inputs than will\n        # fit on the command line.\n        if file_list:\n            contents_list = (\n                contents if isinstance(contents, list) else contents.split(\" \")\n            )\n            replacement = contents_list[0]\n            if os.path.isabs(replacement):\n                raise GypError('| cannot handle absolute paths, got \"%s\"' % replacement)\n\n            if not generator_filelist_paths:\n                path = os.path.join(build_file_dir, replacement)\n            else:\n                if os.path.isabs(build_file_dir):\n                    toplevel = generator_filelist_paths[\"toplevel\"]\n                    rel_build_file_dir = gyp.common.RelativePath(\n                        build_file_dir, toplevel\n                    )\n                else:\n                    rel_build_file_dir = build_file_dir\n                qualified_out_dir = generator_filelist_paths[\"qualified_out_dir\"]\n                path = os.path.join(qualified_out_dir, rel_build_file_dir, replacement)\n                gyp.common.EnsureDirExists(path)\n\n            replacement = gyp.common.RelativePath(path, build_file_dir)\n            f = gyp.common.WriteOnDiff(path)\n            for i in contents_list[1:]:","sourceCodeStart":859,"sourceCodeEnd":895,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/tools/gyp/pylib/gyp/input.py#L859-L895","documentation":"GYP's <|(listfile.txt ...) construct writes a list of items to a generated file at gyp-parse time so that overlong input lists can be passed via a response file. The first token inside the parens is treated as the output filename and must be relative to the build file's directory; the parser refuses absolute output paths so generated files stay inside the build tree. If the first token is absolute (os.path.isabs is true) GYP aborts with this GypError before writing anything.","triggerScenarios":"A .gyp/.gypi file contains an expansion like '<|( /abs/path/listfile.txt a b c)' or '<|( $(rootdir)/out/listfile.txt ...)' where the filename token starts with '/' (POSIX) or a drive root (Windows). It also triggers when a variable expanded into that first token yields an absolute path.","commonSituations":"Hardcoding an absolute build-output directory in a response-file action; copying a path from a shell that resolves to an absolute path; setting a 'variables' entry to an absolute path and feeding it into a <|(...) filename; cross-platform builds where a Windows path like C:\\\\tmp\\\\foo triggers isabs.","solutions":["Make the first token of <|( ... ) a path relative to the .gyp file's own directory (e.g. '<|( gen/listfile.txt ...).","If you need the file under the build output dir, rely on generator_filelist_paths by not forcing an absolute path — let GYP place it via qualified_out_dir.","Check whether an upstream variable (set via -D or in a .gypi include) is injecting an absolute path and rewrite it to be relative.","On Windows, ensure the token is not 'C:\\\\...' or '\\\\\\\\server\\\\share\\\\...'; strip the drive/root before passing it in."],"exampleFix":"// before\n'action': ['<|( /home/me/build/rsp.txt a b c)'],\n// after\n'action': ['<|( gen/rsp.txt a b c)'],","handlingStrategy":"validation","validationCode":"# Before authoring a <|( ... ) clause, ensure the filename token is relative.\nimport os\ntoken = filename_token_from_clause  # first item inside the parens\nassert not os.path.isabs(token), f\"<|() requires a relative path, got {token!r}\"","typeGuard":"def is_relative_response_path(token: str) -> bool:\n    return isinstance(token, str) and not os.path.isabs(token)","tryCatchPattern":null,"preventionTips":["Always use a project-relative directory (e.g. 'gen/...') for <|() output filenames.","Never inject absolute paths via -D variables that feed a <|() filename.","Review <|() clauses after any reorganization of build output directories."],"tags":["gyp","paths","build-config","response-file"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}