clockworklabs/SpacetimeDB · error · anyhow::Error
Server not specified and no default server configured.
Error message
Server not specified and no default server configured.
What it means
Thrown by `spacetime dev` when resolving which server to develop against. The resolver is a two-step chain: the --server CLI flag, then the config's default server (config.default_server_name()). Despite the comment above it mentioning a maincloud fallback, the code has no third default, so when both sources are empty the command errors out immediately.
Solutions
- Pass the server explicitly: `spacetime dev --server maincloud` (or your server's name/URL)
- Set a persistent default once: `spacetime server set-default maincloud` (or add `default_server = "maincloud"` under [server] in the CLI config)
- For CI, always pass --server in the invoked command so runs don't depend on agent-local config
Example fix
# before spacetime dev # after spacetime dev --server maincloud # or persist a default once spacetime server set-default maincloud
Defensive patterns
Strategy: validation
Validate before calling
# Fail fast before dev runs in CI:
spacetime server list | grep -q . || { echo 'configure a server first'; exit 2; }
# Belt and braces: always pass --server explicitly
spacetime dev --server maincloud Prevention
- Run `spacetime server set-default maincloud` once per machine as part of onboarding
- Always pass --server in CI so runs never depend on agent-local config state
- Treat a missing default server as a setup step, not a runtime condition — check it before starting dev
When it happens
Trigger: Running `spacetime dev` (or `spacetime dev <path>`) without --server on a machine whose global config (~/.local/share/spacetime/config.toml or equivalent) has no default_server set — e.g. right after a fresh install, after `spacetime logout`, or after removing the default server entry.
Common situations: Fresh CLI install where setup was skipped; CI containers with no persisted SpacetimeDB config; switching from a local standalone server to maincloud and clearing the old default; team onboarding scripts assuming a default that new machines don't have.
Related errors
- database is a required field in publish config
- Host conflicts with saved configuration for server : ://
- Missing loaded config directory
- Nickname conflicts with saved configuration for server : ://
- Server already configured for host
AI-assisted analysis of clockworklabs/SpacetimeDB@3653d2ed49 (2026-08-20).
Data as JSON: /api/errors/7c8421a1bb2b79c9.
Report an issue: GitHub.
Appendix: source
Thrown at crates/cli/src/subcommands/dev.rs:171
let project_path = args.get_one::<PathBuf>("project-path").unwrap();
let module_path_from_cli = args.get_one::<PathBuf>("module-path");
let module_bindings_path = args.get_one::<PathBuf>("module-bindings-path").unwrap();
let client_language = args.get_one::<Language>("client-lang");
let clear_database = args
.get_one::<ClearMode>("clear-database")
.copied()
.unwrap_or(ClearMode::OnConflict);
let force = args.get_flag("force");
// If you don't specify a server, we default to your default server
// If you don't have one of those, we default to "maincloud"
let server_from_cli = args.get_one::<String>("server").map(|s| s.as_str());
let default_server_name = config.default_server_name().map(|s| s.to_string());
let mut resolved_server = server_from_cli
.or(default_server_name.as_deref())
.ok_or_else(|| anyhow::anyhow!("Server not specified and no default server configured."))?;
let cwd = std::env::current_dir()?;
let mut project_dir = if project_path.is_absolute() {
project_path.clone()
} else {
cwd.join(project_path)
};
if module_bindings_path.is_absolute() {
anyhow::bail!("Module bindings path must be a relative path");
}
let mut module_bindings_dir = project_dir.join(module_bindings_path);
let mut spacetimedb_dir = match module_path_from_cli {
Some(path) => {
if path.is_absolute() {
path.clone()
} else {View on GitHub (pinned to 3653d2ed49)