{"record":{"id":"357abf33f50d63a4","repo":"nodejs/node","slug":"u-parse-error-357abf","errorCode":"U_PARSE_ERROR","errorMessage":"error in preparsed UCD: unknown line type (first field) '%s' on line %ld\n","messagePattern":"error in preparsed UCD: unknown line type \\(first field\\) '(.+?)' on line %ld\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/icu-small/source/tools/toolutil/ppucd.cpp","lineNumber":142,"sourceCode":"    char *limit=strchr(line, 0);\n    while(line<limit && ((c=*(limit-1))=='\\n' || c=='\\r')) { --limit; }\n    // Remove trailing white space.\n    while(line<limit && ((c=*(limit-1))==' ' || c=='\\t')) { --limit; }\n    *limit=0;\n    lineLimit=limit;\n    if(line==limit) {\n        fieldLimit=limit;\n        return lineType=EMPTY_LINE;\n    }\n    // Split by ';'.\n    char *semi=line;\n    while((semi=strchr(semi, ';'))!=nullptr) { *semi++=0; }\n    fieldLimit=strchr(line, 0);\n    // Determine the line type.\n    int32_t type;\n    for(type=EMPTY_LINE+1;; ++type) {\n        if(type==LINE_TYPE_COUNT) {\n            fprintf(stderr,\n                    \"error in preparsed UCD: unknown line type (first field) '%s' on line %ld\\n\",\n                    line, static_cast<long>(lineNumber));\n            errorCode=U_PARSE_ERROR;\n            return NO_LINE;\n        }\n        if(0==strcmp(line, lineTypeStrings[type])) {\n            break;\n        }\n    }\n    lineType = static_cast<LineType>(type);\n    if(lineType==UNICODE_VERSION_LINE && fieldLimit<lineLimit) {\n        u_versionFromString(ucdVersion, fieldLimit+1);\n    }\n    return lineType;\n}\n\nconst char *\nPreparsedUCD::firstField() {","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/icu-small/source/tools/toolutil/ppucd.cpp#L124-L160","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate the file is a preparsed UCD (not raw UCD) before parsing\nimport re\nKNOWN_LINE_TYPES = {'property', 'block', 'cp', 'defaults', 'unassigned',\n                    'algnamesrange', 'unicode_version', 'nameslist', 'empty'}\nwith open(preparsed_path) as f:\n    for lineno, line in enumerate(f, 1):\n        line = line.strip()\n        if not line or line.startswith('#'):\n            continue\n        first_field = line.split(';')[0].strip()\n        if first_field not in KNOWN_LINE_TYPES:\n            print(f'Unknown line type \"{first_field}\" at line {lineno}')","typeGuard":null,"tryCatchPattern":"// C++: check errorCode after readLine\nLineType lt = pucd->readLine(errorCode);\nif (errorCode == U_PARSE_ERROR) {\n    fprintf(stderr, \"Parse error in preparsed UCD — check file format and version\\n\");\n    break;\n}","preventionTips":["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."],"tags":["icu","ucd","parse-error","preparsed-ucd","line-type","validation"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}