nodejs/node · error
couldn't open file %s
Error message
couldn't open file %s
What it means
During collation rule import (GenrbImporter::getRules path), genrb attempts to open a referenced resource file via ucbuf_open and receives U_FILE_ACCESS_ERROR. This specific path handles importing collation tailoring rules from external files. The file could not be opened or read at all — it does not exist or is inaccessible.
Source
Thrown at deps/icu-small/source/tools/genrb/parse.cpp:763
* user should use
* genrb -s. icu/data --- start from CWD and look in icu/data dir
*/
openFileName.append(inputDir, dirlen, errorCode);
if(inputDir[dirlen-1] != U_FILE_SEP_CHAR) {
openFileName.append(U_FILE_SEP_CHAR, errorCode);
}
}
}
openFileName.append(filename, errorCode);
if(U_FAILURE(errorCode)) {
return;
}
// printf("GenrbImporter::getRules(%s, %s) reads %s\n", localeID, collationType, openFileName.data());
const char* cp = "";
LocalUCHARBUFPointer ucbuf(
ucbuf_open(openFileName.data(), &cp, getShowWarning(), true, &errorCode));
if(errorCode == U_FILE_ACCESS_ERROR) {
fprintf(stderr, "couldn't open file %s\n", openFileName.data());
return;
}
if (ucbuf.isNull() || U_FAILURE(errorCode)) {
fprintf(stderr, "An error occurred processing file %s. Error: %s\n", openFileName.data(), u_errorName(errorCode));
return;
}
/* Parse the data into an SRBRoot */
LocalPointer<SRBRoot> data(
parse(ucbuf.getAlias(), inputDir, outputDir, filename.data(), false, false, false, &errorCode));
if (U_FAILURE(errorCode)) {
return;
}
struct SResource *root = data->fRoot;
struct SResource *collations = resLookup(root, "collations");
if (collations != nullptr) {
struct SResource *collation = resLookup(collations, collationType);View on GitHub (pinned to 1b2de5e052)
Solutions
- Verify the imported file exists at the exact path shown in the error message: `ls -la <path>`
- Check file permissions: the file must be readable by the genrb process
- Ensure the -s (source/input directory) option matches where the imported files reside
- On case-sensitive filesystems (Linux), verify the exact filename casing matches
- If the file was recently added, ensure it is included in the build system's file list (e.g. Makefile, BUILD file)
Defensive patterns
Strategy: validation
Validate before calling
# Verify all imported collation files exist before running genrb
INPUT_DIR="./data"
# Find all import references in resource bundles and check their targets
for f in "$INPUT_DIR"/*.txt; do
while IFS= read -r line; do
ref=$(echo "$line" | grep -oP 'import\s*"\K[^"]+')
[ -n "$ref" ] && [ ! -f "$INPUT_DIR/$ref.txt" ] && echo "MISSING: $INPUT_DIR/$ref.txt (referenced in $f)"
done < "$f"
done Prevention
- Verify all import paths in resource bundles resolve before running genrb
- Use the -s option consistently so relative import paths resolve correctly
- On case-sensitive filesystems, ensure filename casing exactly matches references
- Include all referenced files in the build system's file list
When it happens
Trigger: A collation import directive in a resource bundle references a file path that does not exist; the referenced file is in a different directory than expected (inputDir mismatch); the file exists but has restrictive permissions; or the path contains incorrect separators. This occurs in the parse.cpp getRules path, not the main genrb.cpp file-open path.
Common situations: Moving resource bundle files without updating import paths; using relative paths that break when genrb runs from a different working directory; case-sensitivity mismatch on Linux (e.g. 'en_US.txt' vs 'en_US.TXT'); missing collation data files in a custom ICU data build.
Related errors
- --ucadata was used with UCONFIG_NO_COLLATION
- An error occurred processing file %s. Error: %s
- U_MEMORY_ALLOCATION_ERROR
- CollationDataWriter::writeTailoring() failed: %s
- %s: error in command line argument "%s"\n
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/9fde8ddd564e80b1.
Report an issue: GitHub.