nodejs/node · error
Conversion failure at #%X: %s\n
Error message
Conversion failure at #%X: %s\n
What it means
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.
Source
Thrown at deps/icu-small/source/tools/escapesrc/tblgen.cpp:36
UErrorCode status = U_ZERO_ERROR;
LocalUConverterPointer cnv(ucnv_open(kConverter, &status));
if(U_FAILURE(status)) {
fprintf(stderr, "Failed to open %s: %s\n", kConverter, u_errorName(status));
return 1;
}
printf("static const char cp1047_8859_1[256] = { \n");
for(int i=0x00; i<0x100; i++) {
char cp1047[1];
cp1047[0] = i;
char16_t u[1];
char16_t *target = u;
const char *source = cp1047;
ucnv_toUnicode(cnv.getAlias(), &target, u+1, &source, cp1047+1, nullptr, true, &status);
if(U_FAILURE(status)) {
fprintf(stderr, "Conversion failure at #%X: %s\n", i, u_errorName(status));
return 2;
}
printf(" (char)0x%02X, /* %02X */\n", u[0], i);
}
printf("};\n\n");
//
// UnicodeSet oldIllegal("[:print:]", status); // [a-zA-Z0-9_}{#)(><%:;.?*+-/^&|~!=,\\u005b\\u005d\\u005c]", status);
UnicodeSet oldIllegal("[0-9 a-z A-Z "
"_ \\{ \\} \\[ \\] # \\( \\) < > % \\: ; . "
"? * + \\- / \\^ \\& | ~ ! = , \\ \" ' ]", status);
/*
http://www.lirmm.fr/~ducour/Doc-objets/ISO+IEC+14882-1998.pdf ( note: 1998 ) page 10, section 2.2 says:
1 The basic source character set consists of 96 characters: the space character, the control characters repre- 15)
senting horizontal tab, vertical tab, form feed, and new-line, plus the following 91 graphical characters:View on GitHub (pinned to 1b2de5e052)
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).
Defensive patterns
Strategy: try-catch
Validate before calling
// sanity-check the converter round-trips all 256 bytes before tblgen
for (int i=0; i<256; i++) { /* run ucnv_toUnicode on byte i; fail fast on U_FAILURE */ } Try / catch
// wrap the conversion loop and report the first failing byte
UErrorCode status = U_ZERO_ERROR;
ucnv_toUnicode(cnv, &target, u+1, &source, cp1047+1, nullptr, true, &status);
if (U_FAILURE(status)) { /* log byte index + u_errorName(status); abort */ } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Failed to open %s: %s\n
- 1
- icupkg: udata_openSwapper("%s") failed - %s
- Could not open codepage [%s]: %s
- Error: Don't know how to unpack %s with extension %s
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/0e368245347c1ef9.
Report an issue: GitHub.