nodejs/node · error

bundle_compactKeys(%s) or bundle_getKeyBytes() failed: %s

Error message

bundle_compactKeys(%s) or bundle_getKeyBytes() failed: %s

What it means

During pool bundle generation (--write-pool-bundle mode), genrb calls compactKeys() to deduplicate key strings and getKeyBytes() to retrieve the compacted key bytes. If either call sets a UErrorCode failure, the pool bundle cannot be assembled. Pool bundles are a shared-key optimization that reduces total .res file size across a locale set.

Source

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

        }

        if (isVerbose()) {
            filter.print(std::cout);
        }

        // Apply the filter to the data
        ResKeyPath path;
        data->fRoot->applyFilter(filter, path, data.getAlias());
    }

    if(options[WRITE_POOL_BUNDLE].doesOccur) {
        data->fWritePoolBundle = newPoolBundle;
        data->compactKeys(status);
        int32_t newKeysLength;
        const char *newKeys = data->getKeyBytes(&newKeysLength);
        newPoolBundle->addKeyBytes(newKeys, newKeysLength, status);
        if(U_FAILURE(status)) {
            fprintf(stderr, "bundle_compactKeys(%s) or bundle_getKeyBytes() failed: %s\n",
                    filename, u_errorName(status));
            return;
        }
        /* count the number of just-added key strings */
        for(const char *newKeysLimit = newKeys + newKeysLength; newKeys < newKeysLimit; ++newKeys) {
            if(*newKeys == 0) {
                ++newPoolBundle->fKeysCount;
            }
        }
    }

    if(options[USE_POOL_BUNDLE].doesOccur) {
        data->fUsePoolBundle = &poolBundle;
    }

    /* Determine the target rb filename */
    uprv_free(make_res_filename(filename, outputDir, packageName, status));
    if(U_FAILURE(status)) {

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Check the u_errorName code in the message — U_MEMORY_ALLOCATION_ERROR indicates memory pressure, U_BUFFER_OVERFLOW_ERROR indicates too many keys
  2. Reduce the number of unique top-level keys in the resource bundles fed to the pool bundle build
  3. Build with fewer simultaneous parallel genrb processes to reduce memory pressure
  4. If the issue is a key table size limit, split the locale data into multiple pool bundles
  5. Disable pool bundle mode (--write-pool-bundle) if the optimization is not critical for your use case
Defensive patterns

Strategy: validation

Validate before calling

# Before building with --write-pool-bundle, check available memory and key count
free -h
# Estimate unique keys across all locale bundles that will be pooled
grep -ohP '^\s*\w+\s*\{' all_locales/*.txt | sort -u | wc -l

Prevention

When it happens

Trigger: Running genrb with the --write-pool-bundle option on a resource bundle whose key set causes compactKeys() to fail — typically due to an internal key table overflow, hash collision limit, or memory exhaustion during key compaction. The newPoolBundle->addKeyBytes() call can also trigger this if the key byte buffer exceeds capacity.

Common situations: Building ICU data with pool bundle optimization enabled on a very large locale set; using a custom resource bundle with an unusually high number of unique keys; memory pressure during a parallel build of many locales.

Related errors


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