nodejs/node · error

U_PARSE_ERROR

U_PARSE_ERROR

Error message

error in preparsed UCD: unknown line type (first field) '%s' on line %ld

What it means

Thrown by PreparsedUCD when the first semicolon-delimited field of a line does not match any known line type string (property, block, cp, defaults, unassigned, algnamesrange, unicode_version, etc.). The unrecognized field value and line number are printed, and errorCode is set to U_PARSE_ERROR. This indicates the input file is not a valid preparsed UCD.

Source

Thrown at deps/icu-small/source/tools/toolutil/ppucd.cpp:142

    char *limit=strchr(line, 0);
    while(line<limit && ((c=*(limit-1))=='\n' || c=='\r')) { --limit; }
    // Remove trailing white space.
    while(line<limit && ((c=*(limit-1))==' ' || c=='\t')) { --limit; }
    *limit=0;
    lineLimit=limit;
    if(line==limit) {
        fieldLimit=limit;
        return lineType=EMPTY_LINE;
    }
    // Split by ';'.
    char *semi=line;
    while((semi=strchr(semi, ';'))!=nullptr) { *semi++=0; }
    fieldLimit=strchr(line, 0);
    // Determine the line type.
    int32_t type;
    for(type=EMPTY_LINE+1;; ++type) {
        if(type==LINE_TYPE_COUNT) {
            fprintf(stderr,
                    "error in preparsed UCD: unknown line type (first field) '%s' on line %ld\n",
                    line, static_cast<long>(lineNumber));
            errorCode=U_PARSE_ERROR;
            return NO_LINE;
        }
        if(0==strcmp(line, lineTypeStrings[type])) {
            break;
        }
    }
    lineType = static_cast<LineType>(type);
    if(lineType==UNICODE_VERSION_LINE && fieldLimit<lineLimit) {
        u_versionFromString(ucdVersion, fieldLimit+1);
    }
    return lineType;
}

const char *
PreparsedUCD::firstField() {

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Ensure the file is a preparsed UCD (generated by ICU's preparsing tools), not a raw Unicode data file.
  2. Use a preparsed UCD file generated by the same ICU version as the consuming tool.
  3. Regenerate the preparsed UCD file with the correct ICU build tools.
  4. Check for file encoding issues (ensure UTF-8 without BOM).
Defensive patterns

Strategy: validation

Validate before calling

// Validate the file is a preparsed UCD (not raw UCD) before parsing
import re
KNOWN_LINE_TYPES = {'property', 'block', 'cp', 'defaults', 'unassigned',
                    'algnamesrange', 'unicode_version', 'nameslist', 'empty'}
with open(preparsed_path) as f:
    for lineno, line in enumerate(f, 1):
        line = line.strip()
        if not line or line.startswith('#'):
            continue
        first_field = line.split(';')[0].strip()
        if first_field not in KNOWN_LINE_TYPES:
            print(f'Unknown line type "{first_field}" at line {lineno}')

Try / catch

// C++: check errorCode after readLine
LineType lt = pucd->readLine(errorCode);
if (errorCode == U_PARSE_ERROR) {
    fprintf(stderr, "Parse error in preparsed UCD — check file format and version\n");
    break;
}

Prevention

When it happens

Trigger: readLine splits the line by ';' and iterates through lineTypeStrings[] comparing against the first field. If no match is found before LINE_TYPE_COUNT, the fprintf at ppucd.cpp:142 fires.

Common situations: Feeding a raw UCD file (not preparsed) to the tool; using a preparsed UCD from a different ICU version with new line types not recognized by the older parser; file encoding issues (BOM, wrong charset) causing field mismatches; corrupted or hand-edited file with invalid line types.

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/357abf33f50d63a4. Report an issue: GitHub.