bazelbuild/bazel · error
Failed to make absolute path for %s: %s\n
Error message
Failed to make absolute path for %s: %s\n
What it means
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.
Source
Thrown at src/tools/launcher/launcher_maker.cc:47
// It takes exactly 3 arguments:
// 1) The path to the actual launcher executable
// 2) The multi-line .params file containing the launcher info data
// 3) The path of the output executable
//
// The program copies the launcher executable as is to the output, and then
// appends each line of the launch info as a null-terminated string. At the
// end, the size of the launch data written is appended as a long value (8
// bytes).
#ifdef _WIN32
#define STRING_TYPE std::wstring
#define STRING_FORMAT "%ls"
std::wstring convert_path(char* path) {
std::string error;
std::wstring wpath;
if (!blaze_util::AsAbsoluteWindowsPath(path, &wpath, &error)) {
fprintf(stderr, "Failed to make absolute path for %s: %s\n", path,
error.c_str());
exit(1);
}
return wpath;
}
#else // _WIN32
#define STRING_TYPE std::string
#define STRING_FORMAT "%s"
std::string convert_path(char* path) { return path; }
#endif // _WIN32
int main(int argc, char** argv) {
if (argc < 4) {
fprintf(stderr, "Expected 3 arguments, got %d\n", argc);
return 1;View on GitHub (pinned to e6e199d060)
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.
Example fix
# before: launcher_maker.exe launcher.exe info.txt out.exe (relative args from odd cwd) # after: launcher_maker.exe C:\ws\launcher.exe C:\ws\info.txt C:\ws\out.exe
Defensive patterns
Strategy: validation
Validate before calling
// pre-check the path form before invoking launcher_maker on Windows
bool IsAbsoluteWindowsPath(const std::wstring &p) {
return p.size() >= 3 && iswalpha(p[0]) && p[1] == L':' && (p[2] == L'\\' || p[2] == L'/');
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Expected 3 arguments, got %d\n
- Failed to open " STRING_FORMAT ": %s\n
- Failed to create " STRING_FORMAT ": %s\n
- '" + input + "' is not a boolean
- '" + input + "' is not an int
AI-assisted analysis of bazelbuild/bazel@e6e199d060 (2026-08-14).
Data as JSON: /api/errors/370eac4ba3a55086.
Report an issue: GitHub.