{"record":{"id":"d374357449d56d86","repo":"nodejs/node","slug":"u-file-access-error","errorCode":"U_FILE_ACCESS_ERROR","errorMessage":"Error opening <%s>.\\n","messagePattern":"Error opening <(.+?)>\\.\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/icu-small/source/tools/pkgdata/pkgdata.cpp","lineNumber":2057,"sourceCode":"    CharList   *l, *tail = nullptr, *tail2 = nullptr;\n    FileStream *in;\n    char        line[16384];\n    char       *linePtr, *lineNext;\n    const uint32_t   lineMax = 16300;\n    char       *tmp;\n    int32_t     tmpLength = 0;\n    char       *s;\n    int32_t     ln=0; /* line number */\n\n    for(l = o->fileListFiles; l; l = l->next) {\n        if(o->verbose) {\n            fprintf(stdout, \"# pkgdata: Reading %s..\\n\", l->str);\n        }\n        /* TODO: stdin */\n        in = T_FileStream_open(l->str, \"r\"); /* open files list */\n\n        if(!in) {\n            fprintf(stderr, \"Error opening <%s>.\\n\", l->str);\n            *status = U_FILE_ACCESS_ERROR;\n            return;\n        }\n\n        while(T_FileStream_readLine(in, line, sizeof(line))!=nullptr) { /* for each line */\n            ln++;\n            if(uprv_strlen(line)>lineMax) {\n                fprintf(stderr, \"%s:%d - line too long (over %d chars)\\n\", l->str, static_cast<int>(ln), static_cast<int>(lineMax));\n                exit(1);\n            }\n            /* remove spaces at the beginning */\n            linePtr = line;\n            /* On z/OS, disable call to isspace (#9996).  Investigate using uprv_isspace instead (#9999) */\n#if U_PLATFORM != U_PF_OS390\n            while(isspace(*linePtr)) {\n                linePtr++;\n            }\n#endif","sourceCodeStart":2039,"sourceCodeEnd":2075,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/icu-small/source/tools/pkgdata/pkgdata.cpp#L2039-L2075","documentation":"While reading the list of input resource files (the file list passed to pkgdata), T_FileStream_open(l->str,\"r\") failed for one of the listed files. The function sets *status = U_FILE_ACCESS_ERROR and returns immediately, so no resources from any subsequent list files are collected. The name printed is the literal path string from the fileListFiles linked list.","triggerScenarios":"The file list entry l->str points at a path that does not exist, is not readable by the build user, or is a directory rather than a file. Also triggered by a stale file list referencing files deleted after the list was generated.","commonSituations":"An ICU data build where the file list (e.g. tmpdata.res or the -F file) lists a .res that a prior gencnval/genrb step failed to emit; running pkgdata from the wrong CWD so relative paths in the list miss; file permissions stripped by a packaging step.","solutions":["Run pkgdata from the directory the file list paths are relative to.","Inspect the file list (the -F argument) and confirm every path exists and is readable.","Re-run the upstream generator (genrb/make) that should have produced the missing .res files.","Check read permissions on the listed files: ls -l <path>."],"exampleFix":"# before: pkgdata invoked from wrong dir\npkgdata -F reslist.txt -p mypkg\n\n# after: cd into the dir the list is relative to\ncd $OUTDIR && pkgdata -F reslist.txt -p mypkg","handlingStrategy":"validation","validationCode":"// Pre-flight: every path in the file list must exist and be readable.\n#include <unistd.h>\n#include <stdio.h>\n\nbool fileListAllReadable(const char *listFile) {\n    FILE *f = fopen(listFile, \"r\");\n    if (!f) return false;\n    char line[4096];\n    bool ok = true;\n    while (fgets(line, sizeof(line), f)) {\n        line[strcspn(line, \"\\r\\n\")] = 0;\n        if (line[0] && access(line, R_OK) != 0) { ok = false; break; }\n    }\n    fclose(f);\n    return ok;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate the file list with the same tool that emits the .res files.","Run pkgdata from the directory the list paths are relative to.","Validate the list with a pre-flight read check before invoking pkgdata.","Treat a failed upstream genrb as a build stop, not a warning."],"tags":["icu","pkgdata","file-io","build-tool","filesystem","u-file-access-error"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}