{"record":{"id":"370eac4ba3a55086","repo":"bazelbuild/bazel","slug":"failed-to-make-absolute-path-for-s-s-n","errorCode":null,"errorMessage":"Failed to make absolute path for %s: %s\\n","messagePattern":"Failed to make absolute path for (.+?): (.+?)\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/tools/launcher/launcher_maker.cc","lineNumber":47,"sourceCode":"//  It takes exactly 3 arguments:\n//    1) The path to the actual launcher executable\n//    2) The multi-line .params file containing the launcher info data\n//    3) The path of the output executable\n//\n//  The program copies the launcher executable as is to the output, and then\n//  appends each line of the launch info as a null-terminated string. At the\n//  end, the size of the launch data written is appended as a long value (8\n//  bytes).\n\n#ifdef _WIN32\n\n#define STRING_TYPE std::wstring\n#define STRING_FORMAT \"%ls\"\nstd::wstring convert_path(char* path) {\n  std::string error;\n  std::wstring wpath;\n  if (!blaze_util::AsAbsoluteWindowsPath(path, &wpath, &error)) {\n    fprintf(stderr, \"Failed to make absolute path for %s: %s\\n\", path,\n            error.c_str());\n    exit(1);\n  }\n  return wpath;\n}\n\n#else  // _WIN32\n\n#define STRING_TYPE std::string\n#define STRING_FORMAT \"%s\"\nstd::string convert_path(char* path) { return path; }\n\n#endif  // _WIN32\n\nint main(int argc, char** argv) {\n  if (argc < 4) {\n    fprintf(stderr, \"Expected 3 arguments, got %d\\n\", argc);\n    return 1;","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/bazelbuild/bazel/blob/e6e199d0601a244511b4cf18c8b2828aa73db1fd/src/tools/launcher/launcher_maker.cc#L29-L65","documentation":"launcher_maker is the tool that stamps Windows launchers: it converts each argv path to an absolute Windows path with blaze_util::AsAbsoluteWindowsPath; if that conversion fails (error text explains why, e.g. the path has no valid drive/root or is not representable) it prints this message and exits 1, failing the build action.","triggerScenarios":"Passing a launcher, launch-info, or output path that AsAbsoluteWindowsPath rejects: relative paths that cannot be resolved, UNC or device paths in unexpected forms, or invalid drive letters; typically only when launcher_maker is invoked manually or by a rule generating odd paths.","commonSituations":"Custom rules producing workspace-relative or MSYS-style (/c/foo) paths for Windows launcher actions; running launcher_maker.exe by hand from a shell whose cwd is a deleted directory.","solutions":["Read the '%s' error detail after the colon — it names the exact reason AsAbsoluteWindowsPath refused.","Pass fully-qualified Windows paths (C:\\...) rather than MSYS-style or bare relative ones.","If a rule generates the path, fix the rule to use ctx.expand_make_variables / dep-file rooted absolute paths.","Verify the current directory still exists before invoking the tool."],"exampleFix":"# before: launcher_maker.exe launcher.exe info.txt out.exe   (relative args from odd cwd)\n# after:\nlauncher_maker.exe C:\\ws\\launcher.exe C:\\ws\\info.txt C:\\ws\\out.exe","handlingStrategy":"validation","validationCode":"// pre-check the path form before invoking launcher_maker on Windows\nbool IsAbsoluteWindowsPath(const std::wstring &p) {\n  return p.size() >= 3 && iswalpha(p[0]) && p[1] == L':' && (p[2] == L'\\\\' || p[2] == L'/');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass fully-qualified C:\\ paths, not MSYS /c/... forms.","Ensure the tool's cwd exists when relative resolution is involved.","Log the '%s' reason string when the conversion fails — it pinpoints the bad component."],"tags":["windows","launcher","path-conversion","build-tool","cli"],"backgroundTag":null,"analyzedSha":"e6e199d0601a244511b4cf18c8b2828aa73db1fd","analyzedAt":"2026-08-14T10:24:27.848Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}