clockworklabs/SpacetimeDB · error
Unknown index algorithm {:?}
Error message
Unknown index algorithm {:?} What it means
generate_index_name (crates/schema/src/def/validate/v9.rs:1462) maps each index algorithm to a name label: btree, direct, or hash. RawIndexAlgorithm is #[non_exhaustive] with exactly those three variants (crates/lib/src/db/raw_def/v9.rs:309), so an unrecognized variant reaching this function triggers unimplemented!() — meaning the module binary carried an algorithm this host build does not know.
Source
Thrown at crates/schema/src/def/validate/v9.rs:1462
/// Concatenate a list of column names.
fn concat_column_names(table_type: &ProductType, selected: &ColList) -> String {
selected.iter().map(|col| column_name(table_type, col)).join("_")
}
/// All indexes have this name format.
///
/// Generated name should not go through case conversion.
pub fn generate_index_name(
table_name: &Identifier,
table_type: &ProductType,
algorithm: &RawIndexAlgorithm,
) -> RawIdentifier {
let (label, columns) = match algorithm {
RawIndexAlgorithm::BTree { columns } => ("btree", columns),
RawIndexAlgorithm::Direct { column } => ("direct", &col_list![*column]),
RawIndexAlgorithm::Hash { columns } => ("hash", columns),
_ => unimplemented!("Unknown index algorithm {:?}", algorithm),
};
let column_names = concat_column_names(table_type, columns);
RawIdentifier::new(format!("{table_name}_{column_names}_idx_{label}"))
}
/// All sequences have this name format.
///
/// Generated name should not go through case conversion.
pub fn generate_sequence_name(table_name: &Identifier, table_type: &ProductType, column: ColId) -> RawIdentifier {
let column_name = column_name(table_type, column);
RawIdentifier::new(format!("{table_name}_{column_name}_seq"))
}
/// All schedules have this name format.
///
/// Generated name should not go through case conversion.
pub fn generate_schedule_name(table_name: &Identifier) -> RawIdentifier {
RawIdentifier::new(format!("{table_name}_sched"))View on GitHub (pinned to 524b4487d9)
Solutions
- Update the SpacetimeDB host/CLI to a version at or above the SDK used to build the module, then republish
- Or downgrade the SDK in the module to the host's supported ABI version
- Stick to #[index(btree)] / #[index(hash)] / direct indexes on unique columns, which all current hosts accept
Example fix
# before spacetime publish --server mainnet my-module # module built with newer SDK # after spacetime update # or reinstall CLI; then rebuild and republish spacetime publish --server mainnet my-module
Defensive patterns
Strategy: validation
Validate before calling
# Match toolchain before publish: spacetime version # host/CLI version cargo tree -p spacetimedb --depth 0 # SDK version used by the module # If SDK > host, downgrade SDK or update host before building
Prevention
- Lock SDK and host versions in CI (a single SPACETIMEDB_VERSION env var used by both)
- Use only btree/hash/direct index kinds for portable modules
- Rebuild the module .wasm after any toolchain update, never reuse stale artifacts
When it happens
Trigger: Publishing a module compiled against a newer SDK that introduces an additional index algorithm variant to an older host; synthesizing a module ABI with an out-of-range index algorithm tag.
Common situations: cargo update bumping the spacetimedb SDK ahead of the running server; preview toolchains publishing to a stable cluster; module .wasm built on a different machine with a newer toolchain.
Related errors
- Unknown constraint type
- unknown misc export
- Index '${indexLabel}' on table '${tableLabel}' must define a
- Index '${idx.sourceName ?? '<unknown>'}' on table '${tableDe
- never types are not yet supported in C# output
AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16).
Data as JSON: /api/errors/1395b9bd98d39829.
Report an issue: GitHub.