nodejs/node · error
U_BUFFER_OVERFLOW_ERROR
U_BUFFER_OVERFLOW_ERROR
Error message
pathname too long: \"%s\"\n
What it means
Thrown by makeFullFilename() when prepending a directory path to a filename and the resulting path (strlen(path) + 1 for the null terminator) would exceed or fill the destination buffer capacity. This is a path-length guard on a fixed-size char array (typically 1024 bytes) used for constructing full file paths during package item I/O.
Source
Thrown at deps/icu-small/source/tools/toolutil/package.cpp:258
if(*t==U_FILE_SEP_CHAR || *t==U_FILE_ALT_SEP_CHAR) {
*t=U_TREE_ENTRY_SEP_CHAR;
}
}
}
#endif
/*
* Prepend the path (if any) to the name and run the name through treeToName().
*/
static void
makeFullFilename(const char *path, const char *name,
char *filename, int32_t capacity) {
char *s;
// prepend the path unless nullptr or empty
if(path!=nullptr && path[0]!=0) {
if (static_cast<int32_t>(strlen(path) + 1) >= capacity) {
fprintf(stderr, "pathname too long: \"%s\"\n", path);
exit(U_BUFFER_OVERFLOW_ERROR);
}
strcpy(filename, path);
// make sure the path ends with a file separator
s=strchr(filename, 0);
if(*(s-1)!=U_FILE_SEP_CHAR && *(s-1)!=U_FILE_ALT_SEP_CHAR) {
*s++=U_FILE_SEP_CHAR;
}
} else {
s=filename;
}
// turn the name into a filename, turn tree separators into file separators
if (static_cast<int32_t>((s - filename) + strlen(name)) >= capacity) {
fprintf(stderr, "path/filename too long: \"%s%s\"\n", filename, name);
exit(U_BUFFER_OVERFLOW_ERROR);
}View on GitHub (pinned to 1b2de5e052)
Solutions
- Shorten or flatten the directory path passed as the 'path' argument to icupkg or Package methods.
- Use a working directory closer to the filesystem root and pass shorter relative paths.
- Move the ICU data directory to a shorter absolute path.
Example fix
// before icupkg -a /very/long/build/sandbox/hash123abc/path/to/output/dir // after cd /tmp && icupkg -a ./out
Defensive patterns
Strategy: validation
Validate before calling
// Validate path length before calling icupkg with -a or output paths
#include <cstring>
bool isPathLengthSafe(const char* path, int32_t capacity = 1024) {
return path == nullptr || (static_cast<int32_t>(strlen(path) + 1) < capacity);
} Prevention
- Keep ICU build and staging directories short and close to the filesystem root.
- Avoid deeply nested temporary paths in CI environments.
- Use relative paths from a sensible working directory.
When it happens
Trigger: Calling readFile(), writePackage(), or any function that calls makeFullFilename() with a path argument whose strlen(path) + 1 >= capacity (1024 for readFile's local buffer). This occurs when the base directory path alone is too long for the filename buffer.
Common situations: Deeply nested build output directories; ICU data staged under very long temporary paths (e.g. CI build sandboxes with hashed paths); running on systems where the source tree has many directory levels.
Related errors
- U_FILE_ACCESS_ERROR
- U_ILLEGAL_ARGUMENT_ERROR
- U_BUFFER_OVERFLOW_ERROR
- %s: could not open input file %s\n
- %s: could not open output file %s\n
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/7e43e3367b542288.
Report an issue: GitHub.