{"record":{"id":"11d1081e66eac16a","repo":"nodejs/node","slug":"u-file-access-error-11d108","errorCode":"U_FILE_ACCESS_ERROR","errorMessage":"icupkg: unable to create tree directory \\\"%s\\\"\\n","messagePattern":"icupkg: unable to create tree directory \\\\\"(.+?)\\\\\"\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/icu-small/source/tools/toolutil/package.cpp","lineNumber":297,"sourceCode":"}\n\nstatic void\nmakeFullFilenameAndDirs(const char *path, const char *name,\n                        char *filename, int32_t capacity) {\n    char *sep;\n    UErrorCode errorCode;\n\n    makeFullFilename(path, name, filename, capacity);\n\n    // make tree directories\n    errorCode=U_ZERO_ERROR;\n    sep=strchr(filename, 0)-strlen(name);\n    while((sep=strchr(sep, U_FILE_SEP_CHAR))!=nullptr) {\n        if(sep!=filename) {\n            *sep=0;                 // truncate temporarily\n            uprv_mkdir(filename, &errorCode);\n            if(U_FAILURE(errorCode)) {\n                fprintf(stderr, \"icupkg: unable to create tree directory \\\"%s\\\"\\n\", filename);\n                exit(U_FILE_ACCESS_ERROR);\n            }\n        }\n        *sep++=U_FILE_SEP_CHAR; // restore file separator character\n    }\n}\n\nstatic uint8_t *\nreadFile(const char *path, const char *name, int32_t &length, char &type) {\n    char filename[1024];\n    FILE *file;\n    UErrorCode errorCode;\n    int32_t fileLength, typeEnum;\n\n    makeFullFilename(path, name, filename, static_cast<int32_t>(sizeof(filename)));\n\n    /* open the input file, get its length, allocate memory for it, read the file */\n    file=fopen(filename, \"rb\");","sourceCodeStart":279,"sourceCodeEnd":315,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/icu-small/source/tools/toolutil/package.cpp#L279-L315","documentation":"Thrown by makeFullFilenameAndDirs() when uprv_mkdir() fails with a U_FAILURE error code while trying to create intermediate tree directories for a package item's output path. The tool walks the filename's path components, temporarily truncating at each separator to mkdir each level.","triggerScenarios":"Calling writePackage() or any code path that writes package items to a tree directory structure where one of the intermediate directory segments cannot be created. uprv_mkdir() returns a non-zero UErrorCode for permission denied, read-only filesystem, disk quota exceeded, or path-component conflicts (e.g. a file exists where a directory is expected).","commonSituations":"Output directory is read-only or on a mounted filesystem with insufficient permissions; disk full; an existing file occupies a name where a directory is needed; SELinux/AppArmor denies directory creation; CI runners with restricted /tmp or build directories.","solutions":["Verify write permissions on the output directory: ls -ld <dir> and touch <dir>/test.","Check for disk space: df -h <dir>.","Remove any file that conflicts with a needed directory name.","Create the directory tree manually before running icupkg: mkdir -p <dir>."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-create directories and verify writability before running icupkg\n#include <sys/stat.h>\n#include <sys/types.h>\nbool ensureDirWritable(const char* dir) {\n    if (mkdir(dir, 0755) != 0) {\n        struct stat st;\n        if (stat(dir, &st) != 0 || !S_ISDIR(st.st_mode)) return false;\n    }\n    return access(dir, W_OK | X_OK) == 0;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run mkdir -p on the output directory before invoking icupkg.","Verify write permissions on the target directory tree.","Check disk space with df -h before large package operations.","Remove conflicting files that occupy names needed for directories."],"tags":["icu","icupkg","filesystem","permissions","mkdir","file-access"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}