nodejs/node · critical

1

1

Error message

%s: can not initialize ICU.  status = %s

What it means

u_init() failed while opening ICU's core property data, and the failure was anything other than U_FILE_ACCESS_ERROR (which is intentionally ignored because it is expected when bootstrapping ICU from scratch). The actual ICU error code is appended via u_errorName(status). This is the only path in genrb that calls exit(1) immediately, so it bypasses the normal cleanup at the end of main().

Solutions

  1. Install or rebuild the ICU data package so u_init() can locate icudt<ver>.dat.
  2. Verify ICU_DATA / the directory passed via --icudatadir matches the ICU version of the genrb binary (`genrb --version`).
  3. If building ICU from scratch and this error appears with a non-file-access code, finish the data build step before invoking genrb.
  4. When embedding genrb, check u_init()'s status yourself and skip genrb on U_FILE_ACCESS_ERROR to mirror the tool's own bootstrap tolerance.
Defensive patterns

Strategy: try-catch

Validate before calling

# Verify ICU data is locatable before running genrb
if ! command -v genrb >/dev/null 2>&1; then echo "genrb not on PATH" >&2; exit 2; fi
genrb --version
# If ICU_DATA is set, confirm icudt*.dat is reachable
if [ -n "${ICU_DATA:-}" ] && ! ls "$ICU_DATA"/icudt*.dat >/dev/null 2>&1; then
  echo "ERROR: ICU_DATA=$ICU_DATA has no icudt*.dat" >&2; exit 2
fi

Try / catch

# Run genrb, capture exit code, and surface u_init failures distinctly
set +e
genrb "$@" >genrb.log 2>&1
rc=$?
set -e
if [ $rc -eq 1 ] && grep -q 'can not initialize ICU' genrb.log; then
  echo "FATAL: genrb could not initialize ICU - check ICU_DATA / icudt version" >&2
  exit $rc
fi

Prevention

When it happens

Trigger: Running genrb against an ICU build whose data directory points at missing or corrupt icudt*.dat, mixing genrb from one ICU major version with the data tree of another, or a corrupted installation. The diagnostic from u_errorName(status) distinguishes causes (e.g. U_INVALID_FORMAT_ERROR vs U_BUFFER_OVERFLOW_ERROR).

Common situations: Building ICU from source and running genrb before the data .dat package is assembled; installing ICU via a package manager whose data package was split off and not installed; pointing ICU_DATA at a stale directory left by a previous ICU version.

Related errors


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

Appendix: source

Thrown at deps/icu-small/source/tools/genrb/genrb.cpp:297

    if (options[FILTERDIR].doesOccur) {
        filterDir = options[FILTERDIR].value;
    }

    if(options[ENCODING].doesOccur) {
        encoding = options[ENCODING].value;
    }

    if(options[ICUDATADIR].doesOccur) {
        u_setDataDirectory(options[ICUDATADIR].value);
    }
    /* Initialize ICU */
    u_init(&status);
    if (U_FAILURE(status) && status != U_FILE_ACCESS_ERROR) {
        /* Note: u_init() will try to open ICU property data.
         *       failures here are expected when building ICU from scratch.
         *       ignore them.
        */
        fprintf(stderr, "%s: can not initialize ICU.  status = %s\n",
            argv[0], u_errorName(status));
        exit(1);
    }
    status = U_ZERO_ERROR;
    if(options[WRITE_JAVA].doesOccur) {
        write_java = true;
        outputEnc = options[WRITE_JAVA].value;
    }

    if(options[WRITE_XLIFF].doesOccur) {
        write_xliff = true;
        if(options[WRITE_XLIFF].value != nullptr){
            xliffOutputFileName = options[WRITE_XLIFF].value;
        }
    }

    if (options[UCADATA].doesOccur) {
#if !UCONFIG_NO_COLLATION

View on GitHub (pinned to 1b2de5e052)