SECURITY WARNING: Never run commands you don't understand. Always review code before execution. Use at your own risk.
WebAssembly New Added 19 September 2026

WebAssembly: RuntimeError: table index is out of bounds

An indirect call used a function pointer that is not in the module table, which normally means a callback was passed to C or C++ without being registered, or the table was built too small at link time. The pointer looks valid on the Rust or C side because it is just an integer.

Quick fix

Read the commands before running them. Anything that restarts a service, deletes data or changes permissions should be tried on a non-production system first.

Quick fix
# Emscripten: a callback passed to a library needs a slot in the table
emcc app.c -o app.js \
  -sALLOW_TABLE_GROWTH \
  -sEXPORTED_RUNTIME_METHODS=addFunction,removeFunction

// Register the pointer, use it, then give the slot back
const ptr = Module.addFunction((a, b) => a + b, "iii");
Module._sort_with(ptr);
Module.removeFunction(ptr);

# Static table too small rather than missing entries
emcc app.c -o app.js -sINITIAL_TABLE=1024

# Inspect what the module really exports and how big the table is
wasm-objdump -x app.wasm | grep -A3 'Table\['

// A dangling pointer gives the same message: a closure freed on the Rust side
// Closure::into_js_value or a stored Closure keeps it alive for the call

How to diagnose WebAssembly errors

WebAssembly errors are precise about the layer that failed. A CompileError means the bytes are not a valid module: most often the file was served with the wrong MIME type, or an HTML error page was fetched instead of the .wasm file. A RuntimeError: memory access out of bounds means the module read or wrote outside its linear memory, which in a language like C or Rust is a genuine memory-safety bug caught by the sandbox.

If the quick fix above does not resolve it, work through these steps. They apply to this whole class of error, not just to this one message, which is usually what saves the time.

  1. Check what the server actually returned. The wasm file must be served as application/wasm for streaming compilation, and a 404 HTML page produces a misleading magic-number error.
  2. Validate the module offline with wasm-validate and inspect it with wasm-objdump -x from the WABT toolkit.
  3. For out-of-bounds errors, rebuild with sanitizers or debug assertions in the source language. The wasm runtime cannot tell you which source line was responsible without DWARF info.
  4. Confirm imports match: every function the module imports must be supplied by the host with the exact name and signature, or instantiation fails.
  5. Build with debug symbols and use the browser's DWARF support to step through original source rather than raw wasm.

Tools worth reaching for

  • wasm-validate / wasm-objdump (WABT)
  • browser DWARF debugging
  • wasmtime --invoke
  • curl -I (check MIME type)

Authoritative references

Primary documentation for this error, worth reading before applying any fix in production.

emscripten.org webassembly.github.io

Related WebAssembly errors

See all 10 WebAssembly errors →

Browse other categories

Something missing or wrong?

This entry is maintained by hand. If the fix is out of date, incomplete, or you have a better one, email a correction and it will be reviewed.