nodejs/node · error
U_INVALID_CHAR_FOUND
U_INVALID_CHAR_FOUND
Error message
icupkg/ures_enumDependencies(%s res=%08x) alias string contains non-invariant characters\n
What it means
checkAlias validates that a resource-bundle alias string uses only invariant characters; if uprv_isInvariantUString fails it prints the item name + resource handle and sets *pErrorCode = U_INVALID_CHAR_FOUND (returns, does not exit). Alias strings must be invariant so they can be safely byte-swapped and matched.
Source
Thrown at deps/icu-small/source/tools/toolutil/pkgitems.cpp:229
}
checkIDSuffix(itemName, parent, parentLength, suffix, check, context, pErrorCode);
}
// get dependencies from resource bundles ---------------------------------- ***
static const char16_t SLASH=0x2f;
/*
* Check for the alias from the string or alias resource res.
*/
static void
checkAlias(const char *itemName,
Resource res, const char16_t *alias, int32_t length, UBool useResSuffix,
CheckDependency check, void *context, UErrorCode *pErrorCode) {
int32_t i;
if(!uprv_isInvariantUString(alias, length)) {
fprintf(stderr, "icupkg/ures_enumDependencies(%s res=%08x) alias string contains non-invariant characters\n",
itemName, res);
*pErrorCode=U_INVALID_CHAR_FOUND;
return;
}
// extract the locale ID from alias strings like
// locale_ID/key1/key2/key3
// locale_ID
// search for the first slash
for(i=0; i<length && alias[i]!=SLASH; ++i) {}
if(res_getPublicType(res)==URES_ALIAS) {
// ignore aliases with an initial slash:
// /ICUDATA/... and /pkgname/... go to a different package
// /LOCALE/... are for dynamic sideways fallbacks and don't go to a fixed bundle
if(i==0) {
return; // initial slash ('/')View on GitHub (pinned to 1b2de5e052)
Solutions
- Regenerate the offending .res from the source locale XML/txt with current genrb.
- Audit aliases for non-invariant characters: any byte > 0x7F or control char in an alias is invalid.
- Do not hand-edit compiled .res files; edit source and recompile.
- Run the ICU data build cleanly from a trusted source tree.
Example fix
# before: alias contains a non-invariant char (e.g. a raw UTF-8 byte) # in source locale data the alias was edited to include non-ASCII genrb bad.txt # produces a .res with a non-invariant alias # after: fix the alias in source to use only invariant (ASCII) characters genrb fixed.txt
Defensive patterns
Strategy: validation
Validate before calling
// C++: validate alias bytes are invariant before relying on them
#include "unicode/utypes.h"
bool aliasIsSafe(const char16_t *alias, int32_t len) {
return uprv_isInvariantUString(alias, len); // false => would trigger U_INVALID_CHAR_FOUND
} Type guard
// narrows an alias to 'safe to swap/match' before use
bool isInvariantAlias(const char16_t *alias, int32_t len) {
return alias != nullptr && len >= 0 && uprv_isInvariantUString(alias, len);
} Try / catch
// checkAlias sets *pErrorCode; caller must test it after enumerating deps
UErrorCode err = U_ZERO_ERROR;
ures_enumDependencies(..., &err);
if (err == U_INVALID_CHAR_FOUND) { /* a non-invariant alias was found; rebuild the .res */ } Prevention
- Edit locale source (.txt) and recompile with genrb; never hand-edit compiled .res.
- Keep alias strings ASCII/invariant only.
- Run a dependency-enumeration pass and check for U_INVALID_CHAR_FOUND before shipping data.
- Regenerate suspect .res from a trusted source tree.
When it happens
Trigger: A .res resource contains an alias with non-ASCII or otherwise non-invariant characters; a corrupt resource bundle where alias data is damaged. The guard is the first check in checkAlias.
Common situations: Hand-edited or corrupt locale resource data with bad alias entries; a .res produced by tooling that wrote non-invariant bytes into an alias; encoding corruption during transfer.
Related errors
- icupkg: udata_openSwapper(\"%s\") failed - %s\n
- U_MEMORY_ALLOCATION_ERROR
- U_BUFFER_OVERFLOW_ERROR
- missing list file\n
- U_MEMORY_ALLOCATION_ERROR
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/426269ad7cd21c54.
Report an issue: GitHub.