clockworklabs/SpacetimeDB · error · anyhow::Error

Invalid entity_type ' '. Expected one of: reducer, table.

Error message

Invalid entity_type '{}'. Expected one of: reducer, table.

What it means

`spacetime describe [database] [entity_type entity_name]` validates entity_type against exactly two literals: `reducer` and `table`. Anything else — plausible-but-unsupported words like `index`, `schedule`, `view`, or plain typos — bails with this message.

Solutions

  1. Use `reducer` or `table` as the entity type
  2. Run `spacetime describe <db>` with no entity args to inspect the whole schema
  3. Use --json output to search the full module definition for the entity you wanted

Example fix

# before
spacetime describe my-db schedule tick

# after
spacetime describe my-db reducer tick
Defensive patterns

Strategy: type-guard

Validate before calling

fn is_valid_entity_type(s: &str) -> bool {
    matches!(s, "reducer" | "table")
}

Type guard

enum EntityType { Reducer, Table }

fn parse_entity_type(s: &str) -> Option<EntityType> {
    match s {
        "reducer" => Some(EntityType::Reducer),
        "table" => Some(EntityType::Table),
        _ => None,
    }
}

Prevention

When it happens

Trigger: Running `spacetime describe my-db schedule tick` — 'schedule' is not an accepted entity type; only 'reducer' and 'table' parse.

Common situations: Typos; assuming entity kinds that exist in other tools or newer versions; copy-pasting commands from mismatched docs.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


AI-assisted analysis of clockworklabs/SpacetimeDB@6dee26c6ef (2026-08-20). Data as JSON: /api/errors/a91f5a1594c63f8a. Report an issue: GitHub.

Appendix: source

Thrown at crates/cli/src/subcommands/describe.rs:74

    let no_config = args.get_flag("no_config");
    let raw_parts: Vec<String> = args
        .get_many::<String>("describe_parts")
        .map(|vals| vals.cloned().collect())
        .unwrap_or_default();
    let config_targets = load_config_db_targets(no_config)?;
    let resolved = resolve_database_with_optional_parts(
        &raw_parts,
        config_targets.as_deref(),
        "spacetime describe [database] [entity_type entity_name] --json [--no-config]",
    )?;
    let entity = match resolved.remaining_args.as_slice() {
        [] => None,
        [entity_type, entity_name] => {
            let entity_type = match entity_type.as_str() {
                "reducer" => EntityType::Reducer,
                "table" => EntityType::Table,
                _ => {
                    anyhow::bail!(
                        "Invalid entity_type '{}'. Expected one of: reducer, table.",
                        entity_type
                    )
                }
            };
            Some((entity_type, entity_name.as_str()))
        }
        _ => {
            anyhow::bail!(
                "Invalid describe arguments.\nUsage: spacetime describe [database] [entity_type entity_name] --json [--no-config]"
            );
        }
    };

    let mut config = config;
    let server_from_cli = args.get_one::<String>("server").map(|s| s.as_ref());
    let server = server_from_cli.or(resolved.server.as_deref());
    let force = args.get_flag("force");

View on GitHub (pinned to 6dee26c6ef)