nodejs/node · warning
Warning: The top level tag in the resource and language spec
Error message
Warning: The top level tag in the resource and language specified are not the same. Please check the input.
What it means
During XLIFF XML output, genrb compares the language code extracted from the filename/table name (lang) against the bundle's internal locale string (srBundle->fLocale). If they differ, it prints this warning to stderr. This is a non-fatal warning — processing continues. It signals a potential mismatch between the bundle's identity and its declared language.
Source
Thrown at deps/icu-small/source/tools/genrb/wrtxml.cpp:1158
*status = U_FILE_ACCESS_ERROR;
goto cleanup_bundle_write_xml;
}
write_utf8_file(out, UnicodeString(xmlHeader));
if(outputEnc && *outputEnc!='\0'){
/* store the output encoding */
enc = outputEnc;
conv=ucnv_open(enc,status);
if(U_FAILURE(*status)){
goto cleanup_bundle_write_xml;
}
}
write_utf8_file(out, UnicodeString(bundleStart));
write_tabs(out);
write_utf8_file(out, UnicodeString(fileStart));
/* check if lang and language are the same */
if(language != nullptr && uprv_strcmp(lang, srBundle->fLocale)!=0){
fprintf(stderr,"Warning: The top level tag in the resource and language specified are not the same. Please check the input.\n");
}
write_utf8_file(out, UnicodeString(lang));
write_utf8_file(out, UnicodeString(file1));
write_utf8_file(out, UnicodeString(file2));
write_utf8_file(out, UnicodeString(originalFileName));
write_utf8_file(out, UnicodeString(file4));
time(&currTime);
strftime(timeBuf, sizeof(timeBuf), "%Y-%m-%dT%H:%M:%SZ", gmtime(&currTime));
write_utf8_file(out, UnicodeString(timeBuf));
write_utf8_file(out, UnicodeString("\">\n"));
tabCount += 1;
write_tabs(out);
write_utf8_file(out, UnicodeString(headerStart));
tabCount += 1;
write_tabs(out);View on GitHub (pinned to 1b2de5e052)
Solutions
- Check if the filename and the top-level table name inside the .txt file match — they should use the same locale code
- If using -l, ensure it matches the bundle's actual locale
- Update the top-level table name to match the filename, or vice versa
- If the mismatch is intentional (e.g. alias processing), suppress the warning by redirecting stderr or using --quiet if available
- This is a warning only — verify the XLIFF output has the correct xml:lang attribute and proceed if it is correct
Example fix
// before: filename/table mismatch
file: en_US.txt
contents:
fr {
greeting { "Bonjour" }
}
// after: filename and table name match
file: fr.txt
contents:
fr {
greeting { "Bonjour" }
} Defensive patterns
Strategy: validation
Validate before calling
# Check for filename/table name locale mismatch before genrb --write-xliff
for f in data/*.txt; do
base=$(basename "$f" .txt)
# Extract the top-level table name from the file
table=$(grep -m1 -oP '^\s*\K\w+(?=\s*\{)' "$f" 2>/dev/null | head -1)
if [ -n "$table" ] && [ "$base" != "$table" ]; then
echo "MISMATCH: $f - filename='$base' table='$table'"
fi
done Prevention
- Keep resource bundle filenames consistent with their internal top-level table names
- When creating locale files from templates, update both the filename and the internal table name
- If using -l, ensure it matches the bundle's actual locale
- Treat this warning as a prompt to verify the XLIFF xml:lang attribute is correct
When it happens
Trigger: The language code parsed from the filename (or provided via -l) does not match the locale string stored in the bundle (srBundle->fLocale). For example, the file is named 'en_US.txt' but the top-level table inside is 'root' or 'fr'. The warning is printed but the XLIFF output proceeds with the 'lang' value.
Common situations: Renaming a .txt file without updating the top-level table name inside it; copy-pasting a locale file as a template for a different locale and forgetting to update the internal name; specifying -l with a different language than the bundle's actual locale; CLDR data files where the filename convention differs from the table name.
Related errors
- Could not canonicalize the locale ID: %s. Error: %s
- U_ILLEGAL_CHAR_FOUND
- U_MEMORY_ALLOCATION_ERROR
- U_ILLEGAL_ARGUMENT_ERROR
- %s: error in command line argument "%s"\n
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/3100eebc4e9cdc4a.
Report an issue: GitHub.