{"record":{"id":"0e368245347c1ef9","repo":"nodejs/node","slug":"conversion-failure-at-x-s-n","errorCode":null,"errorMessage":"Conversion failure at #%X: %s\\n","messagePattern":"Conversion failure at #%X: (.+?)\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/icu-small/source/tools/escapesrc/tblgen.cpp","lineNumber":36,"sourceCode":"\n  UErrorCode status = U_ZERO_ERROR;\n  LocalUConverterPointer cnv(ucnv_open(kConverter, &status));\n\n  if(U_FAILURE(status)) {\n    fprintf(stderr, \"Failed to open %s: %s\\n\", kConverter, u_errorName(status));\n    return 1;\n  }\n\n  printf(\"static const char cp1047_8859_1[256] = { \\n\");\n  for(int i=0x00; i<0x100; i++) {\n    char cp1047[1];\n    cp1047[0] = i;\n    char16_t u[1];\n    char16_t *target = u;\n    const char *source = cp1047;\n    ucnv_toUnicode(cnv.getAlias(), &target, u+1, &source, cp1047+1, nullptr, true, &status);\n    if(U_FAILURE(status)) {\n      fprintf(stderr, \"Conversion failure at #%X: %s\\n\", i, u_errorName(status));\n      return 2;\n    }\n    printf(\" (char)0x%02X, /* %02X */\\n\", u[0], i);\n  }\n  printf(\"};\\n\\n\");\n\n  // \n  //  UnicodeSet oldIllegal(\"[:print:]\", status); // [a-zA-Z0-9_}{#)(><%:;.?*+-/^&|~!=,\\\\u005b\\\\u005d\\\\u005c]\", status);\n  UnicodeSet oldIllegal(\"[0-9 a-z A-Z \"\n                        \"_ \\\\{ \\\\} \\\\[ \\\\] # \\\\( \\\\) < > % \\\\: ; . \"\n                        \"? * + \\\\- / \\\\^ \\\\& | ~ ! = , \\\\ \\\" ' ]\", status);\n  \n  /*\n\nhttp://www.lirmm.fr/~ducour/Doc-objets/ISO+IEC+14882-1998.pdf ( note: 1998 )   page 10, section 2.2 says:\n\n1 The basic source character set consists of 96 characters: the space character, the control characters repre- 15)\nsenting horizontal tab, vertical tab, form feed, and new-line, plus the following 91 graphical characters:","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/icu-small/source/tools/escapesrc/tblgen.cpp#L18-L54","documentation":"In tblgen's loop over all 256 code points, ucnv_toUnicode converts each cp1047 byte to a UTF-16 code unit. If conversion fails for any byte (U_FAILURE(status)), tblgen reports the failing byte index (#%X) and the ICU error name, then exits 2. This indicates the open converter cannot map a specific byte.","triggerScenarios":"ucnv_toUnicode sets a failing status for some byte i in 0x00..0xFF. With a correctly opened ibm-1047 converter this should not happen; it indicates a corrupt/incomplete converter table or that the converter was opened against a different alias whose mapping is partial.","commonSituations":"ICU data corruption (partial write of cnvalias or nfc data); an aliased name resolved to a different, incomplete converter; version skew between the converter data and the headers; a custom data export that truncated converter tables.","solutions":["Rebuild/refresh the ICU data package so the ibm-1047 converter table is complete and intact.","Verify the alias actually resolves to IBM-1047 (use `icuinfo -L` / ucnv_getName) rather than a different partial converter.","Check for data file corruption in the build output tree (re-extract icudt)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// sanity-check the converter round-trips all 256 bytes before tblgen\nfor (int i=0; i<256; i++) { /* run ucnv_toUnicode on byte i; fail fast on U_FAILURE */ }","typeGuard":null,"tryCatchPattern":"// wrap the conversion loop and report the first failing byte\nUErrorCode status = U_ZERO_ERROR;\nucnv_toUnicode(cnv, &target, u+1, &source, cp1047+1, nullptr, true, &status);\nif (U_FAILURE(status)) { /* log byte index + u_errorName(status); abort */ }","preventionTips":["Rebuild the ICU data package from a trusted source if any converter table is suspect.","Add a tblgen smoke test to CI that asserts a zero exit and a known table checksum."],"tags":["icu","tblgen","converter","ebcdic","icu-data"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}