nodejs/node · error
error in preparsed UCD: '%s' is not a valid code point range
Error message
error in preparsed UCD: '%s' is not a valid code point range on line %ld
What it means
Thrown by PreparsedUCD::parseCodePointRange() when u_parseCodePointRange() fails to parse the input string as a valid code point range. Unlike parseCodePoint, this error does not overwrite the errorCode — it returns the existing failure code set by u_parseCodePointRange. The expected format is 'XXXX..YYYY' (hex start..end).
Source
Thrown at deps/icu-small/source/tools/toolutil/ppucd.cpp:537
PreparsedUCD::parseCodePoint(const char *s, UErrorCode &errorCode) {
char *end;
uint32_t value = static_cast<uint32_t>(uprv_strtoul(s, &end, 16));
if(end<=s || *end!=0 || value>=0x110000) {
fprintf(stderr,
"error in preparsed UCD: '%s' is not a valid code point on line %ld\n",
s, static_cast<long>(lineNumber));
errorCode=U_PARSE_ERROR;
return U_SENTINEL;
}
return static_cast<UChar32>(value);
}
UBool
PreparsedUCD::parseCodePointRange(const char *s, UChar32 &start, UChar32 &end, UErrorCode &errorCode) {
uint32_t st, e;
u_parseCodePointRange(s, &st, &e, &errorCode);
if(U_FAILURE(errorCode)) {
fprintf(stderr,
"error in preparsed UCD: '%s' is not a valid code point range on line %ld\n",
s, static_cast<long>(lineNumber));
return false;
}
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);View on GitHub (pinned to 1b2de5e052)
Solutions
- Ensure the range uses the 'XXXX..YYYY' format with exactly two dots as separator.
- Verify start <= end and both are valid hex code points within 0x0000-0x10FFFF.
- Check for stray characters or incorrect delimiters in the range field.
- Regenerate the ppucd data using the official ICU tools.
Example fix
// before algnamesrange;3400-4DBF // after algnamesrange;3400..4DBF
Defensive patterns
Strategy: validation
Validate before calling
// Validate a code point range string 'XXXX..YYYY'
#include <cstdlib>
#include <cstring>
bool isValidCodePointRange(const char* s) {
if (s == nullptr) return false;
const char* dots = strstr(s, "..");
if (dots == nullptr) return false;
// Parse start
char* end;
unsigned long start = strtoul(s, &end, 16);
if (end != dots) return false;
// Parse end
const char* endStr = dots + 2;
unsigned long endVal = strtoul(endStr, &end, 16);
if (*end != '\0') return false;
if (start >= 0x110000 || endVal >= 0x110000) return false;
return (start <= endVal);
} Prevention
- Always use the 'XXXX..YYYY' format with two dots for code point ranges.
- Verify start <= end in all range fields.
- Ensure range values are within the valid Unicode codespace.
When it happens
Trigger: Calling parseCodePointRange() with a malformed range string — missing '..' separator, reversed range (end < start), non-hex values, or a range exceeding 0x10FFFF. This is used by getRangeForAlgNames() and property range parsing.
Common situations: Malformed range syntax in ppucd algnamesrange lines; using a single dash '-' instead of '..'; reversed start/end values; Unicode version data where ranges were incorrectly generated.
Related errors
- error in preparsed UCD: '%s' is not a valid Unicode string o
- 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/ecefe397f1b02ef7.
Report an issue: GitHub.