clockworklabs/SpacetimeDB · error · anyhow::Error
getrandom usage detected. It seems like either you or a cra
Error message
getrandom usage detected. It seems like either you or a crate in your dependency tree is depending on the `getrandom` crate for random number generation. getrandom is the default randomness source for the `rand` crate, and is used when you call `rand::random()` or `rand::thread_rng()`. If this is you, you should instead use `ctx.rng()` on a `ReducerContext`. If this is a crate in your tree, you should try to see if the crate provides a way to pass in a custom `Rng` type, and pass it the rng returned from `ctx.rng()`.
What it means
Error "getrandom usage detected. It seems like either you or a crate in your dependency tree is depending on the `getrandom` crate for random number generation. getrandom is the default randomness source for the `rand` crate, and is used when you call `rand::random()` or `rand::thread_rng()`. If this is you, you should instead use `ctx.rng()` on a `ReducerContext`. If this is a crate in your tree, you should try to see if the crate provides a way to pass in a custom `Rng` type, and pass it the rng returned from `ctx.rng()`." thrown in clockworklabs/SpacetimeDB.
Source
Thrown at crates/cli/src/tasks/rust.rs:133
};
let Ok(module) = wasmbin::Module::decode_from(&mut io::BufReader::new(file)) else {
return Ok(());
};
if has_wasm_bindgen(&module) {
anyhow::bail!(
"wasm-bindgen detected.\n\
\n\
It seems like either you or a crate in your dependency tree is depending on\n\
wasm-bindgen. wasm-bindgen is only for webassembly modules that target the web\n\
platform, and will not work in the context of SpacetimeDB.\n\
\n\
To find the offending dependency, run `cargo tree -i wasm-bindgen`. Try checking\n\
its cargo features for 'js' or 'web' or 'wasm-bindgen' to see if there's a way\n\
to disable it."
)
}
if has_getrandom(&module) {
anyhow::bail!(
"getrandom usage detected.\n\
\n\
It seems like either you or a crate in your dependency tree is depending on\n\
the `getrandom` crate for random number generation. getrandom is the default\n\
randomness source for the `rand` crate, and is used when you call\n\
`rand::random()` or `rand::thread_rng()`. If this is you, you should instead\n\
use `ctx.rng()` on a `ReducerContext`. If this is a crate in your\n\
tree, you should try to see if the crate provides a way to pass in a custom\n\
`Rng` type, and pass it the rng returned from `ctx.rng()`."
)
}
Ok(())
}
const WBINDGEN_PREFIX: &str = "__wbindgen";
fn has_wasm_bindgen(module: &wasmbin::Module) -> bool {
let check_import = |import: &wasmbin::sections::Import| {
import.path.module.starts_with(WBINDGEN_PREFIX) || import.path.name.starts_with(WBINDGEN_PREFIX)View on GitHub (pinned to 524b4487d9)
When it happens
Trigger: Thrown at crates/cli/src/tasks/rust.rs:133 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16).
Data as JSON: /api/errors/e633513e0fad29ce.
Report an issue: GitHub.