clockworklabs/SpacetimeDB · error · io::Error
InvalidData
InvalidData
Error message
workspace manifest is not a table
What it means
When preparing a build, the spacetime CLI parses the module workspace's Cargo.toml and requires the TOML document's root to be a table (mapping). Valid TOML documents are virtually always root tables, so this InvalidData error is a defensive check that mainly fires on malformed or exotic files. If you see it, the manifest is not a normal Cargo mapping.
Source
Thrown at crates/cli/build.rs:449
// We happen to know our own directory structure, so we can just walk the tree to get to the root.
let repo_root = manifest_dir.join("..").join("..");
repo_root.canonicalize().unwrap_or_else(|err| {
panic!(
"Failed to canonicalize repo_root path {}: {err:#?}",
repo_root.display()
)
})
}
fn extract_workspace_metadata(path: &Path) -> io::Result<(String, BTreeMap<String, String>)> {
let content = fs::read_to_string(path)?;
let parsed: Value = content
.parse()
.map_err(|err| io::Error::new(io::ErrorKind::InvalidData, err))?;
let table = parsed
.as_table()
.ok_or_else(|| io::Error::new(io::ErrorKind::InvalidData, "workspace manifest is not a table"))?;
let workspace = table
.get("workspace")
.and_then(Value::as_table)
.ok_or_else(|| io::Error::new(io::ErrorKind::InvalidData, "workspace section missing"))?;
let edition = workspace
.get("package")
.and_then(Value::as_table)
.and_then(|pkg| pkg.get("edition"))
.and_then(Value::as_str)
.unwrap_or("2021")
.to_string();
let mut versions = BTreeMap::new();
if let Some(deps) = workspace.get("dependencies").and_then(Value::as_table) {
for (name, value) in deps {
let version_opt = match value {View on GitHub (pinned to 524b4487d9)
Solutions
- Inspect the Cargo.toml the CLI resolved and restore it to a normal Cargo mapping (keys plus [sections])
- If the file is corrupt, restore it from version control
- Recreate the module layout with `spacetime new` if the manifest is unrecoverable
Defensive patterns
Strategy: validation
Validate before calling
let text = std::fs::read_to_string(&manifest)?;
let v: toml::Value = text.parse()?;
if !v.is_table() {
anyhow::bail!("{} is not a valid TOML mapping", manifest.display());
} Prevention
- Keep the module Cargo.toml exactly as scaffolded by `spacetime new`
- Run `cargo metadata` as a preflight — if Cargo accepts the manifest, the shape is fine
- Never hand-write exotic TOML at the root of a module workspace
When it happens
Trigger: `spacetime build` or publish resolving a Cargo.toml whose parsed TOML root is not a table — a malformed or non-Cargo file rather than a valid manifest.
Common situations: Corrupted or hand-constructed Cargo.toml; in practice almost all real manifest problems surface as 'workspace section missing' instead.
Related errors
AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16).
Data as JSON: /api/errors/1da7ada6db5a2b6a.
Report an issue: GitHub.