clockworklabs/SpacetimeDB · error · anyhow::Error
Invalid subcommand: {unknown}
Error message
Invalid subcommand: {unknown} What it means
`spacetime login` accepts only the `show` subcommand (plus bare invocation to perform the login). Any other first argument falls through the match in exec_subcommand and is rejected as invalid (login.rs:91).
Source
Thrown at crates/cli/src/subcommands/login.rs:91
Err(_) => println!("Token saved."),
}
return Ok(());
}
if let Some(server) = server_issued_login {
let host = Url::parse(&config.get_host_url(Some(server))?)?;
spacetimedb_login_and_save(&mut config, &host, true, open_browser).await?;
} else {
spacetimedb_login_and_save(&mut config, &host, false, open_browser).await?;
}
Ok(())
}
async fn exec_subcommand(config: Config, cmd: &str, args: &ArgMatches) -> Result<(), anyhow::Error> {
match cmd {
"show" => exec_show(config, args).await,
unknown => Err(anyhow::anyhow!("Invalid subcommand: {unknown}")),
}
}
async fn exec_show(config: Config, args: &ArgMatches) -> Result<(), anyhow::Error> {
let include_token = args.get_flag("token");
let token = if let Some(token) = config.spacetimedb_token() {
token
} else {
println!("You are not logged in. Run `spacetime login` to log in.");
return Ok(());
};
let identity = decode_identity(token)?;
println!("You are logged in as {identity}");
if include_token {
println!("Your auth token (don't share this!) is {token}");View on GitHub (pinned to 524b4487d9)
Solutions
- Use the top-level `spacetime logout` to log out
- Use `spacetime login show` (optionally `--token`) to display the current identity and token
- Run `spacetime login --help` to see the accepted forms before guessing
Example fix
// before spacetime login logout // after spacetime logout
Defensive patterns
Strategy: validation
Validate before calling
sub="${1:-}"
if [[ -n "$sub" && "$sub" != show ]]; then
echo "unknown subcommand: $sub (accepted: show)" >&2; exit 2
fi
spacetime login "$@" Prevention
- Run `spacetime <cmd> --help` to list valid subcommands
- Remember logout is top-level: `spacetime logout`
When it happens
Trigger: Running `spacetime login logout`, `spacetime login whoami`, `spacetime login status`, or any other word after `login` that is not `show`.
Common situations: Assuming `spacetime login logout` mirrors the top-level `spacetime logout`; guessing subcommands by analogy with other CLIs; tab-completion gaps.
Related errors
- Module code was generated with an incompatible version of th
- Unsupported --dotnet-version {version}. Supported values: 8,
- No such saved server configuration: {server} Add a new serve
- No default server configuration. Set an existing server as t
- Server nickname {} already in use: {}://{}
AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16).
Data as JSON: /api/errors/e9e6ace581d15d54.
Report an issue: GitHub.