{"record":{"id":"f8c6abc1b502e814","repo":"nodejs/node","slug":"err-path-too-long-d-chars-s-n","errorCode":null,"errorMessage":"## ERR: Path too long [%d chars]: %s\\n","messagePattern":"## ERR: Path too long \\[(.+?) chars\\]: (.+?)\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"deps/icu-small/source/tools/pkgdata/pkgtypes.c","lineNumber":230,"sourceCode":"CharList *pkg_appendUniqueDirToList(CharList *l, CharList** end, const char *strAlias) {\n    char aBuf[1024];\n    char *rPtr;\n    rPtr = uprv_strrchr(strAlias, U_FILE_SEP_CHAR);\n#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR)\n    {\n        char *aPtr = uprv_strrchr(strAlias, U_FILE_ALT_SEP_CHAR);\n        if(!rPtr || /* regular char wasn't found or.. */\n            (aPtr && (aPtr > rPtr)))\n        { /* alt ptr exists and is to the right of r ptr */\n            rPtr = aPtr; /* may copy NULL which is OK */\n        }\n    }\n#endif\n    if(!rPtr) {\n        return l; /* no dir path */\n    }\n    if((rPtr-strAlias) >= UPRV_LENGTHOF(aBuf)) {\n        fprintf(stderr, \"## ERR: Path too long [%d chars]: %s\\n\", (int)sizeof(aBuf), strAlias);\n        return l;\n    }\n    strncpy(aBuf, strAlias,(rPtr-strAlias));\n    aBuf[rPtr-strAlias]=0;  /* no trailing slash */\n    convertToNativePathSeparators(aBuf);\n\n    if(!pkg_listContains(l, aBuf)) {\n        return pkg_appendToList(l, end, uprv_strdup(aBuf));\n    } else {\n        return l; /* already found */\n    }\n}\n\n#if 0\nstatic CharList *\npkg_appendFromStrings(CharList *l, CharList** end, const char *s, int32_t len)\n{\n  CharList *endptr = NULL;","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/icu-small/source/tools/pkgdata/pkgtypes.c#L212-L248","documentation":"In the directory-extraction helper (pkgtypes.c), the directory portion of a path (rPtr-strAlias) is compared against UPRV_LENGTHOF(aBuf); if it meets or exceeds that fixed buffer size the path is rejected as too long. The function prints the buffer size and the offending path and returns the list unchanged (no directory added). This is non-fatal — the entry is simply not added to the directory list.","triggerScenarios":"A file path whose directory prefix is at least as long as aBuf. The directory is then not recorded in the deduplicated directory list used for packaging.","commonSituations":"Very deep ICU data trees (translit%/locale%/long subpaths); absolute paths embedded by a build script; pathological locale names.","solutions":["Shorten the directory prefix of the offending path (fewer/shorter path components).","Flatten the resource tree layout where possible.","Move the build root closer to the filesystem root to reduce absolute path length.","Regenerate the file list to avoid embedding long common prefixes."],"exampleFix":"# before: directory prefix >= aBuf length\n/opt/very/deep/.../icu/translit/locale/path/file.res\n\n# after: shorten the tree\n/icu/translit/locale/path/file.res","handlingStrategy":"validation","validationCode":"// Warn (non-fatal) when a path's directory prefix is too long for aBuf.\n#include <string.h>\n#include <libgen.h>\nbool dirPrefixFits(const char *path, size_t aBufSize) {\n    char tmp[4096]; strncpy(tmp, path, sizeof(tmp)-1); tmp[sizeof(tmp)-1]=0;\n    char *d = dirname(tmp);\n    return strlen(d) < aBufSize;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Shorten directory prefixes in the resource tree.","Flatten deep locale/translit subpaths.","Build near the filesystem root to cut path length.","Treat as a warning — the entry is skipped, not fatal."],"tags":["icu","pkgdata","pkgtypes","build-tool","input-validation","paths"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}