nodejs/node · error
couldn't parse the file %s. Error:%s
Error message
couldn't parse the file %s. Error:%s
What it means
genrb's top-level file processor failed to parse a resource bundle .txt source file into an SRBRoot tree. The parse() function returned null or set a UErrorCode failure after reading the file via ucbuf_open. This is genrb's main parse-failure exit path: the file was found and opened, but its contents could not be parsed as valid ICU resource bundle syntax.
Source
Thrown at deps/icu-small/source/tools/genrb/genrb.cpp:680
fprintf(stderr, "couldn't open file %s\n", openFileName.data());
return;
}
if (ucbuf.isNull() || U_FAILURE(status)) {
fprintf(stderr, "An error occurred processing file %s. Error: %s\n",
openFileName.data(), u_errorName(status));
return;
}
/* auto detected popular encodings? */
if (cp!=nullptr && isVerbose()) {
printf("autodetected encoding %s\n", cp);
}
/* Parse the data into an SRBRoot */
data.adoptInstead(parse(ucbuf.getAlias(), inputDir, outputDir, filename,
!omitBinaryCollation, options[NO_COLLATION_RULES].doesOccur, options[ICU4X_MODE].doesOccur, &status));
if (data.isNull() || U_FAILURE(status)) {
fprintf(stderr, "couldn't parse the file %s. Error:%s\n", filename, u_errorName(status));
return;
}
// Run filtering before writing pool bundle
if (filterDir != nullptr) {
CharString filterFileName(filterDir, status);
filterFileName.appendPathPart(filename, status);
if (U_FAILURE(status)) {
return;
}
// Open the file and read it into filter
SimpleRuleBasedPathFilter filter;
std::ifstream f(filterFileName.data());
if (f.fail()) {
std::cerr << "genrb error: unable to open " << filterFileName.data() << std::endl;
status = U_FILE_ACCESS_ERROR;
return;View on GitHub (pinned to 1b2de5e052)
Solutions
- Run genrb with -v (verbose) to see the specific parse error line number and u_errorName code before this message
- Open the .txt file at the reported filename and check brace nesting, colons after keys, and string quoting
- Verify the file encoding is UTF-8 (or matching BOM) using `file --mime-encoding <filename>`
- Diff against a known-good version of the resource bundle to isolate the introduced syntax error
- If upgrading ICU, check the changelog for resource bundle grammar changes and update the file accordingly
Example fix
// before: malformed resource bundle entry
root {
greeting { "Hello" }
// missing closing brace for nested table
}
// after: properly balanced braces
root {
greeting { "Hello" }
} Defensive patterns
Strategy: validation
Validate before calling
# Before running genrb, validate the .txt resource bundle syntax
# Check for balanced braces
python3 -c "
import sys
text = open(sys.argv[1]).read()
depth = 0
for i, c in enumerate(text):
if c == '{': depth += 1
elif c == '}': depth -= 1
if depth < 0:
print(f'Unmatched closing brace at offset {i}')
sys.exit(1)
if depth != 0:
print(f'Unmatched opening braces: {depth} unclosed')
sys.exit(1)
print('Brace balance OK')
" path/to/bundle.txt Prevention
- Run genrb -v (verbose) during development to catch parse errors early with line numbers
- Validate brace nesting and colon-after-key syntax before committing resource bundle edits
- Keep resource bundle .txt files under version control so parse errors can be diffed against the last good version
- Use a linter or editor plugin for ICU resource bundle syntax if available
When it happens
Trigger: Calling genrb on a .txt file with syntax errors: unclosed braces, missing colons, invalid escape sequences, malformed tagged-string entries, or unparseable nested table/array structures. Also triggered when the file's detected encoding conflicts with its actual byte content, or when ICU4X mode or NO_COLLATION_RULES options produce incompatible parse states.
Common situations: Hand-editing a resource bundle .txt and introducing a brace mismatch or typo; upgrading ICU versions where the resource bundle grammar changed; feeding a non-resource-bundle .txt file (e.g. a README) to genrb by mistake; encoding mismatches after a git checkout on a different OS.
Related errors
- An error occurred processing file %s. Error: %s
- %s: error in command line argument "%s"\n
- %s: Error: don't specify an encoding (-e) when writing to st
- %s: error in command line argument "%s"\n
- %s: cannot combine --writePoolBundle and --usePoolBundle\n
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/c83c789308f7ec69.
Report an issue: GitHub.