{"record":{"id":"8134fd970409c1c7","repo":"clockworklabs/SpacetimeDB","slug":"invalid-subcommand-unknown","errorCode":null,"errorMessage":"Invalid subcommand: {unknown}","messagePattern":"Invalid subcommand: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/src/lib.rs","lineNumber":77,"sourceCode":"        \"publish\" => publish::exec(config, args).await,\n        \"delete\" => delete::exec(config, args).await,\n        \"logs\" => logs::exec(config, args).await,\n        \"sql\" => sql::exec(config, args).await,\n        \"mcp\" => mcp::exec(config, args).await,\n        \"rename\" => dns::exec(config, args).await,\n        \"generate\" => generate::exec(config, args).await,\n        \"list\" => list::exec(config, args).await,\n        \"init\" => init::exec(config, args).await.map(|_| ()),\n        \"build\" => build::exec(config, args).await.map(drop),\n        \"server\" => server::exec(config, paths, args).await,\n        \"subscribe\" => subscribe::exec(config, args).await,\n        \"start\" => return start::exec(config, paths, args).await,\n        \"login\" => login::exec(config, args).await,\n        \"logout\" => logout::exec(config, args).await,\n        \"lock\" => lock::exec(config, args).await,\n        \"unlock\" => unlock::exec(config, args).await,\n        \"version\" => return subcommands::version::exec(paths, root_dir, args).await,\n        unknown => Err(anyhow::anyhow!(\"Invalid subcommand: {unknown}\")),\n    }\n    .map(|()| ExitCode::SUCCESS)\n}\n\n/// An error type indicating that the process should exit silently with the\n/// given `ExitCode`.\n#[derive(thiserror::Error, Debug)]\n#[error(\"exit with {0:?}\")]\npub struct ExitWithCode(pub ExitCode);\n\nimpl ExitWithCode {\n    /// Basic unsuccessful termination.\n    pub const FAILURE: Self = ExitWithCode(ExitCode::FAILURE);\n}\n","sourceCodeStart":59,"sourceCodeEnd":92,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/cli/src/lib.rs#L59-L92","documentation":"The CLI's hand-rolled dispatcher (crates/cli/src/lib.rs exec) matches the first positional against known subcommands (generate, list, init, build, server, subscribe, start, login, logout, lock, unlock, version, …); the catch-all arm produces this error for anything unrecognized. It is the moral equivalent of clap's 'unrecognized subcommand', including when the word is actually a misspelled or removed command name.","triggerScenarios":"Running `spacetime <word>` where <word> is not in the dispatch list — typo, wrong case, or a command that no longer exists in the installed CLI version.","commonSituations":"Typos like `spacetime buidl`; using subcommands renamed/removed across CLI releases (the spacetime CLI restructured its commands over time); stale shell completions suggesting old names; passing a global flag where the subcommand is expected.","solutions":["Run `spacetime help` (or bare `spacetime`) to list the subcommands valid for your installed version","Fix the spelling/case of the subcommand","If the command used to exist, check `spacetime version` and upgrade the CLI — command names have changed between releases","Regenerate shell completions after upgrading so suggestions match"],"exampleFix":"# before\nspacetime puslish mydb\n\n# after\nspacetime publish mydb","handlingStrategy":"type-guard","validationCode":"const KNOWN = new Set(['generate','list','init','build','server','subscribe','start','login','logout','lock','unlock','version','help']);\nconst cmd = process.argv[2];\nif (!KNOWN.has(cmd)) {\n  console.error(`unknown subcommand '${cmd}'; valid: ${[...KNOWN].join(', ')}`);\n  process.exit(2);\n}","typeGuard":"const isSubcommand = (s) =>\n  ['generate','list','init','build','server','subscribe','start','login','logout','lock','unlock','version']\n    .includes(s);","tryCatchPattern":"# In shell wrappers, verify before delegating\nspacetime \"$cmd\" --help >/dev/null 2>&1 || { echo \"invalid subcommand: $cmd\"; exit 2; }","preventionTips":["Pin the CLI version in CI and run `spacetime help` after upgrades to re-learn the subcommand set","Let the CLI generate shell completions (`spacetime completion` if available) so typos surface at tab-completion time"],"tags":["spacetimedb","cli","subcommand","usage","typo"],"backgroundTag":"unknown-cli-command","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}