{"record":{"id":"3a723eebb97b4824","repo":"nodejs/node","slug":"couldn-t-open-file-s","errorCode":null,"errorMessage":"couldn't open file %s","messagePattern":"couldn't open file (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/icu-small/source/tools/genrb/genrb.cpp","lineNumber":663,"sourceCode":"             */\n            if( (filename[0] != U_FILE_SEP_CHAR) && (inputDir[dirlen-1] !='.')){\n                openFileName.append(inputDir, status);\n            }\n        } else {\n            openFileName.append(inputDir, status);\n        }\n    }\n    openFileName.appendPathPart(filename, status);\n\n    // Test for CharString failure\n    if (U_FAILURE(status)) {\n        return;\n    }\n\n    ucbuf.adoptInstead(ucbuf_open(openFileName.data(), &cp,getShowWarning(),true, &status));\n    if(status == U_FILE_ACCESS_ERROR) {\n\n        fprintf(stderr, \"couldn't open file %s\\n\", openFileName.data());\n        return;\n    }\n    if (ucbuf.isNull() || U_FAILURE(status)) {\n        fprintf(stderr, \"An error occurred processing file %s. Error: %s\\n\",\n                openFileName.data(), u_errorName(status));\n        return;\n    }\n    /* auto detected popular encodings? */\n    if (cp!=nullptr && isVerbose()) {\n        printf(\"autodetected encoding %s\\n\", cp);\n    }\n    /* Parse the data into an SRBRoot */\n    data.adoptInstead(parse(ucbuf.getAlias(), inputDir, outputDir, filename,\n            !omitBinaryCollation, options[NO_COLLATION_RULES].doesOccur, options[ICU4X_MODE].doesOccur, &status));\n\n    if (data.isNull() || U_FAILURE(status)) {\n        fprintf(stderr, \"couldn't parse the file %s. Error:%s\\n\", filename, u_errorName(status));\n        return;","sourceCodeStart":645,"sourceCodeEnd":681,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/icu-small/source/tools/genrb/genrb.cpp#L645-L681","documentation":"Inside processFile(), after constructing openFileName (from inputDir + the resource filename), genrb calls ucbuf_open() to read and decode the source .txt. If the returned status is exactly U_FILE_ACCESS_ERROR, it prints \"couldn't open file <path>\" and returns from processFile without aborting the whole run, so other files in the batch continue. This is the input-file equivalent of error 767.","triggerScenarios":"Passing a filename that does not exist under the source directory; wrong --sourcedir; typos in the file list; permission denied on a source .txt.","commonSituations":"Build scripts globbing a list that includes stale entries; running genrb from the wrong working directory; case-sensitivity mismatches between macOS/Windows and Linux checkouts.","solutions":["Verify the printed path exists: `ls -l <openFileName>`.","Check --sourcedir / the current working directory and the filename spelling/case.","Ensure the source .txt is readable by the user running genrb."],"exampleFix":"// before\ngenrb -s wrong/dir root.txt\n// after\ngenrb -s correct/dir root.txt","handlingStrategy":"validation","validationCode":"src_dir=\"${SOURCEDIR:-.}\"\nfor f in \"$@\"; do\n  if [ ! -r \"$src_dir/$f\" ]; then\n    echo \"ERROR: source file '$src_dir/$f' missing or unreadable\" >&2; exit 2\n  fi\ndone","typeGuard":null,"tryCatchPattern":"genrb -s \"$src_dir\" \"$@\" 2>err.log\nif grep -q \"couldn't open file\" err.log; then\n  echo \"One or more source .txt files were not found in $src_dir\" >&2; exit 1\nfi","preventionTips":["Generate the file list from an actual directory listing rather than a hand-maintained list.","Run genrb from a consistent working directory or always pass -s/--sourcedir."],"tags":["icu","genrb","input-file","file-not-found","filesystem"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}