nodejs/node · error
error in preparsed UCD: '%s' is not a valid Unicode string o
Error message
error in preparsed UCD: '%s' is not a valid Unicode string on line %ld
What it means
Thrown by PreparsedUCD::parseString() when u_parseString() fails to parse the input as a valid Unicode string after attempting both an initial parse and a buffer-overflow retry with an enlarged buffer. This function is used for multi-character string properties like Case_Folding, Lowercase_Mapping, Titlecase_Mapping, and Uppercase_Mapping. Note: this error does not set errorCode itself — it only reports the pre-existing U_FAILURE from u_parseString.
Source
Thrown at deps/icu-small/source/tools/toolutil/ppucd.cpp:559
}
start = static_cast<UChar32>(st);
end = static_cast<UChar32>(e);
return true;
}
void
PreparsedUCD::parseString(const char *s, UnicodeString &uni, UErrorCode &errorCode) {
char16_t *buffer=toUCharPtr(uni.getBuffer(-1));
int32_t length=u_parseString(s, buffer, uni.getCapacity(), nullptr, &errorCode);
if(errorCode==U_BUFFER_OVERFLOW_ERROR) {
errorCode=U_ZERO_ERROR;
uni.releaseBuffer(0);
buffer=toUCharPtr(uni.getBuffer(length));
length=u_parseString(s, buffer, uni.getCapacity(), nullptr, &errorCode);
}
uni.releaseBuffer(length);
if(U_FAILURE(errorCode)) {
fprintf(stderr,
"error in preparsed UCD: '%s' is not a valid Unicode string on line %ld\n",
s, static_cast<long>(lineNumber));
}
}
void
PreparsedUCD::parseScriptExtensions(const char *s, UnicodeSet &scx, UErrorCode &errorCode) {
if(U_FAILURE(errorCode)) { return; }
scx.clear();
CharString scString;
for(;;) {
const char *scs;
const char *scLimit=strchr(s, ' ');
if(scLimit!=nullptr) {
scs = scString.clear().append(s, static_cast<int32_t>(scLimit - s), errorCode).data();
if(U_FAILURE(errorCode)) { return; }
} else {
scs=s;View on GitHub (pinned to 1b2de5e052)
Solutions
- Ensure string property values use the correct format: space-separated hexadecimal UTF-16 code units.
- Verify there are no stray characters, missing spaces, or incomplete code unit pairs in the field.
- Cross-reference with official Unicode case mapping data to verify the expected value format.
- Check for BOM or encoding issues in the ppucd file that could corrupt string fields.
Example fix
// before 00DF;Lowercase_Mapping=00DF;... // after 00DF;Lowercase_Mapping=00DF;... // For multi-char mappings, use space-separated units: // before: Case_Folding=00730073 // after: Case_Folding=0073 0073
Defensive patterns
Strategy: validation
Validate before calling
// Pre-validate string property fields as space-separated hex code units
#include <cstring>
#include <cstdlib>
bool isValidUnicodeStringField(const char* s) {
if (s == nullptr || *s == '\0') return false; // empty may be valid for some properties
const char* p = s;
while (*p) {
// Skip leading spaces
while (*p == ' ') p++;
if (*p == '\0') break;
// Parse hex code unit
char* end;
strtoul(p, &end, 16);
if (end == p) return false; // not a hex digit
p = end;
}
return true;
} Prevention
- Ensure string property values are space-separated hexadecimal UTF-16 code units.
- Do not use raw UTF-8 text or other encodings in string property fields.
- Validate string field formatting before building ICU data.
When it happens
Trigger: A ppucd string property field contains malformed escape sequences or invalid UTF-like syntax. u_parseString expects a specific format (typically space-separated hex code units); any deviation causes failure. The error is triggered for fields like 'lc=', 'uc=', 'tc=', 'cf=' with invalid content.
Common situations: Missing or incorrect space separators between code units in string fields; using raw UTF-8 text instead of hex-encoded code units; truncated escape sequences; encoding issues in the ppucd file.
Related errors
- error in preparsed UCD: '%s' is not a valid code point range
- U_PARSE_ERROR
- An error occurred processing file %s. Error: %s
- couldn't parse the file %s. Error:%s
- Error generating assembly code for data.
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/80f33f8cc29c305b.
Report an issue: GitHub.