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
- Ensure the file is a preparsed UCD (generated by ICU's preparsing tools), not a raw Unicode data file.
- Use a preparsed UCD file generated by the same ICU version as the consuming tool.
- Regenerate the preparsed UCD file with the correct ICU build tools.
- 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
- Always use preparsed UCD files generated by the same ICU version's build tools.
- Never feed raw Unicode data files to PreparsedUCD.
- Validate the first few lines of the file to confirm it's preparsed format.
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
- U_FILE_ACCESS_ERROR
- error in preparsed UCD: '%s' is not a valid code point range
- error in preparsed UCD: '%s' is not a valid Unicode string o
- Illegal utf-8 sequence at Column: %d\n
- An error occurred processing file %s. Error: %s
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/357abf33f50d63a4.
Report an issue: GitHub.