{"record":{"id":"ecefe397f1b02ef7","repo":"nodejs/node","slug":"error-in-preparsed-ucd-s-is-not-a-valid-code-p","errorCode":null,"errorMessage":"error in preparsed UCD: '%s' is not a valid code point range on line %ld\n","messagePattern":"error in preparsed UCD: '(.+?)' is not a valid code point range on line %ld\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/icu-small/source/tools/toolutil/ppucd.cpp","lineNumber":537,"sourceCode":"PreparsedUCD::parseCodePoint(const char *s, UErrorCode &errorCode) {\n    char *end;\n    uint32_t value = static_cast<uint32_t>(uprv_strtoul(s, &end, 16));\n    if(end<=s || *end!=0 || value>=0x110000) {\n        fprintf(stderr,\n                \"error in preparsed UCD: '%s' is not a valid code point on line %ld\\n\",\n                s, static_cast<long>(lineNumber));\n        errorCode=U_PARSE_ERROR;\n        return U_SENTINEL;\n    }\n    return static_cast<UChar32>(value);\n}\n\nUBool\nPreparsedUCD::parseCodePointRange(const char *s, UChar32 &start, UChar32 &end, UErrorCode &errorCode) {\n    uint32_t st, e;\n    u_parseCodePointRange(s, &st, &e, &errorCode);\n    if(U_FAILURE(errorCode)) {\n        fprintf(stderr,\n                \"error in preparsed UCD: '%s' is not a valid code point range on line %ld\\n\",\n                s, static_cast<long>(lineNumber));\n        return false;\n    }\n    start = static_cast<UChar32>(st);\n    end = static_cast<UChar32>(e);\n    return true;\n}\n\nvoid\nPreparsedUCD::parseString(const char *s, UnicodeString &uni, UErrorCode &errorCode) {\n    char16_t *buffer=toUCharPtr(uni.getBuffer(-1));\n    int32_t length=u_parseString(s, buffer, uni.getCapacity(), nullptr, &errorCode);\n    if(errorCode==U_BUFFER_OVERFLOW_ERROR) {\n        errorCode=U_ZERO_ERROR;\n        uni.releaseBuffer(0);\n        buffer=toUCharPtr(uni.getBuffer(length));\n        length=u_parseString(s, buffer, uni.getCapacity(), nullptr, &errorCode);","sourceCodeStart":519,"sourceCodeEnd":555,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/icu-small/source/tools/toolutil/ppucd.cpp#L519-L555","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nalgnamesrange;3400-4DBF\n// after\nalgnamesrange;3400..4DBF","handlingStrategy":"validation","validationCode":"// Validate a code point range string 'XXXX..YYYY'\n#include <cstdlib>\n#include <cstring>\n\nbool isValidCodePointRange(const char* s) {\n    if (s == nullptr) return false;\n    const char* dots = strstr(s, \"..\");\n    if (dots == nullptr) return false;\n    // Parse start\n    char* end;\n    unsigned long start = strtoul(s, &end, 16);\n    if (end != dots) return false;\n    // Parse end\n    const char* endStr = dots + 2;\n    unsigned long endVal = strtoul(endStr, &end, 16);\n    if (*end != '\\0') return false;\n    if (start >= 0x110000 || endVal >= 0x110000) return false;\n    return (start <= endVal);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["icu","ucd","parse-error","build-tool","code-point-range"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}