clockworklabs/SpacetimeDB · warning
Error checking for wasm32 target: {err}
Error message
Error checking for wasm32 target: {err} What it means
has_wasm32_target (crates/cli/src/detect.rs:51) probes for the wasm32-unknown-unknown target by running `rustc --print target-libdir --target wasm32-unknown-unknown` and checking the printed path exists. Any failure in that probe (rustc not found on PATH, rustup shim errors, target not installed) is printed to stderr prefixed with this message and the function returns false - the error is swallowed, and callers then treat the wasm32 toolchain as absent (typically surfacing later as a 'target not installed' build hint).
Source
Thrown at crates/cli/src/detect.rs:51
false
}
}
}
/// Check if the target `wasm32-unknown-unknown` is installed.
pub(crate) fn has_wasm32_target() -> bool {
let result = || {
let path = cmd!(
"rustc",
"--print",
"target-libdir",
"--target",
"wasm32-unknown-unknown"
)
.read()?;
Path::new(path.trim())
.try_exists()
.map_err(|err: io::Error| anyhow::anyhow!(err))
};
result().unwrap_or_else(|err| {
eprintln!("Error checking for wasm32 target: {err}");
false
})
}
/// Check if a given `PackageManager` executable is available on `PATH`.
///
/// On Windows, npm/pnpm/yarn are `.cmd` shims while bun is a `.exe`,
/// so we check the platform-appropriate extension.
pub(crate) fn has_package_manager(pm: crate::spacetime_config::PackageManager) -> bool {
let name = pm.to_string();
if cfg!(windows) {
// bun ships as bun.exe; npm, pnpm, yarn are .cmd shims
let ext = if name == "bun" { "exe" } else { "cmd" };
find_executable(format!("{name}.{ext}")).is_some()View on GitHub (pinned to 6dee26c6ef)
Solutions
- Install the target into the active toolchain: `rustup target add wasm32-unknown-unknown`.
- Verify the probe itself succeeds: `rustc --print target-libdir --target wasm32-unknown-unknown` must print an existing directory - if `rustc --version` fails, fix PATH or reinstall rustup first.
- Check toolchain overrides (rust-toolchain.toml in the project or parents) resolve to a toolchain that has the target; add the target to that pinned toolchain.
- Re-run `spacetime build` after fixing; the stderr warning should disappear.
Example fix
# before spacetime build # stderr: Error checking for wasm32 target: ... # after rustup target add wasm32-unknown-unknown spacetime build
Defensive patterns
Strategy: validation
Validate before calling
// Preflight the toolchain before building modules.
fn wasm_toolchain_ok() -> bool {
Command::new("rustc").arg("--version").output().map(|o| o.status.success()).unwrap_or(false)
&& Command::new("rustc")
.args(["--print", "target-libdir", "--target", "wasm32-unknown-unknown"])
.output()
.map(|o| o.status.success())
.unwrap_or(false)
}
assert!(wasm_toolchain_ok(), "run: rustup target add wasm32-unknown-unknown"); Prevention
- Provision CI images with `rustup target add wasm32-unknown-unknown` baked in.
- Check rust-toolchain.toml overrides also carry the wasm target for the pinned toolchain.
- Treat the 'Error checking for wasm32 target' stderr line as a hard hint: fix rustc/PATH before investigating build failures downstream.
When it happens
Trigger: Running `spacetime build` (or anything that calls has_wasm32_target) when rustc is missing from PATH, when the active rustup toolchain lacks wasm32-unknown-unknown, or when the rustup proxy itself errors (broken installation, unmanaged toolchain override from rust-toolchain.toml).
Common situations: Fresh machines with rustup installed but targets missing; CI images where rustc is not on PATH for the shell invoking the CLI; project-level rust-toolchain.toml pinning a toolchain without the wasm target; broken rustup after a partial upgrade.
Related errors
- Cannot extract accessor name from query
- could not serialize result: object had neither a `ok` nor an
- Tried to read ${n} byte(s) at relative offset ${this.offset}
- Cannot semijoin a table to itself
- Cannot extract table name from query
AI-assisted analysis of clockworklabs/SpacetimeDB@6dee26c6ef (2026-08-20).
Data as JSON: /api/errors/43e3ea1cd08d6974.
Report an issue: GitHub.