nodejs/node · error
ures_swap(pool bundle %s) failed: %s
Error message
ures_swap(pool bundle %s) failed: %s
What it means
After the swapper was created successfully, ures_swap() failed while byte-swapping the pool bundle in place. ures_swap also validates that the data looks like a well-formed .res file, so a failure here means the structure (bundle indexes, resource offsets) is internally inconsistent even though the outer header parsed. The error code is printed via u_errorName.
Source
Thrown at deps/icu-small/source/tools/genrb/genrb.cpp:410
fprintf(stderr, "unable to read the pool bundle file %s\n", poolFileName.data());
return 1;
}
/*
* Swap the pool bundle so that a single checked-in file can be used.
* The swapper functions also test that the data looks like
* a well-formed .res file.
*/
ds = udata_openSwapperForInputData(poolBundle.fBytes, bytesRead,
U_IS_BIG_ENDIAN, U_CHARSET_FAMILY, &status);
if (U_FAILURE(status)) {
fprintf(stderr, "udata_openSwapperForInputData(pool bundle %s) failed: %s\n",
poolFileName.data(), u_errorName(status));
return status;
}
ures_swap(ds, poolBundle.fBytes, bytesRead, poolBundle.fBytes, &status);
udata_closeSwapper(ds);
if (U_FAILURE(status)) {
fprintf(stderr, "ures_swap(pool bundle %s) failed: %s\n",
poolFileName.data(), u_errorName(status));
return status;
}
header = reinterpret_cast<const DataHeader*>(poolBundle.fBytes);
if (header->info.formatVersion[0] < 2) {
fprintf(stderr, "invalid format of pool bundle file %s\n", poolFileName.data());
return U_INVALID_FORMAT_ERROR;
}
const int32_t* pRoot = reinterpret_cast<const int32_t*>(
reinterpret_cast<const char*>(header) + header->dataHeader.headerSize);
poolBundle.fIndexes = pRoot + 1;
indexLength = poolBundle.fIndexes[URES_INDEX_LENGTH] & 0xff;
if (indexLength <= URES_INDEX_POOL_CHECKSUM) {
fprintf(stderr, "insufficient indexes[] in pool bundle file %s\n", poolFileName.data());
return U_INVALID_FORMAT_ERROR;
}
int32_t keysBottom = 1 + indexLength;
int32_t keysTop = poolBundle.fIndexes[URES_INDEX_KEYS_TOP];View on GitHub (pinned to 1b2de5e052)
Solutions
- Regenerate pool.res cleanly with `genrb --writePoolBundle <dir> ...` and rerun.
- Compare ICU versions of the writer and reader binaries (`genrb --version`).
- If the error persists, inspect pool.res with `icupkg -l` to validate its structure.
Defensive patterns
Strategy: validation
Validate before calling
command -v icupkg >/dev/null 2>&1 && icupkg -l "$POOL_DIR/pool.res" >/dev/null 2>&1 || {
echo "ERROR: pool.res failed icupkg structural check; regenerate it" >&2; exit 2; } Try / catch
genrb --usePoolBundle "$POOL_DIR" "$@" 2>err.log || {
grep -q 'ures_swap(pool bundle' err.log && \
echo "pool.res failed structural swap; rerun --writePoolBundle" >&2
exit 1
} Prevention
- Treat pool.res as ephemeral; regenerate on every clean build.
- Delete pool.res if its producer build was interrupted.
When it happens
Trigger: pool.res that has a valid DataHeader but corrupt .res internals; a partially-written pool.res from a crashed --writePoolBundle run; an endianness mismatch that the swapper cannot reconcile.
Common situations: Interrupted builds leaving a half-written pool.res; filesystem corruption; version skew between the tool that wrote pool.res and the one consuming it.
Related errors
- udata_openSwapperForInputData(pool bundle %s) failed: %s
- %s: cannot combine --writePoolBundle and --usePoolBundle\n
- %s: cannot combine --formatVersion 1 with --writePoolBundle
- unable to create an empty bundle for the pool keys: %s
- U_MEMORY_ALLOCATION_ERROR
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/6410911da94d4924.
Report an issue: GitHub.