clockworklabs/SpacetimeDB · error · anyhow::Error
No matching target found in spacetime.json for the provided
Error message
No matching target found in spacetime.json for the provided arguments. Use --no-config to ignore the config file.
What it means
A spacetime.json was discovered and loaded (the CLI prints 'Using configuration from ...'), but none of its targets match the server/database arguments passed to publish. Rather than guessing, publish bails and suggests --no-config (publish.rs:421). Unlike error 175, this fires when the filtered target set is empty even before database-name matching details matter.
Source
Thrown at crates/cli/src/subcommands/publish.rs:421
&& args.contains_id("module_path")
&& let Some(module_path) = args.get_one::<PathBuf>("module_path")
{
owned_loaded = find_and_load_with_env_from(env, module_path.clone())?;
}
owned_loaded.as_ref().inspect(|loaded| {
if !quiet_config {
for path in &loaded.loaded_files {
println!("Using configuration from {}", path.display());
}
}
})
};
let (using_config, publish_configs) = if let Some(loaded) = loaded_config_ref {
let filtered = get_filtered_publish_configs(&loaded.config, &cmd, &schema, args)?;
if filtered.is_empty() {
anyhow::bail!(
"No matching target found in spacetime.json for the provided arguments. \
Use --no-config to ignore the config file."
);
}
(true, filtered)
} else {
(
false,
vec![CommandConfig::new(&schema, std::collections::HashMap::new(), args)?],
)
};
let clear_database = args
.get_one::<ClearMode>("clear-database")
.copied()
.unwrap_or(ClearMode::Never);
let yes = yes_flags_from_args(args);
let config_dir = loaded_config_ref.map(|lc| lc.config_dir.as_path());View on GitHub (pinned to 524b4487d9)
Solutions
- Check the 'Using configuration from ...' output to see which spacetime.json was picked up
- Align your --server/--database arguments with a target defined in that file
- Edit spacetime.json (add or fix a target) to match the intended deployment
- Pass --no-config to publish purely from CLI arguments
Example fix
// before spacetime publish --server https://other.example.com // after: align with spacetime.json, or bypass it spacetime publish --no-config --server https://other.example.com
Defensive patterns
Strategy: validation
Validate before calling
# see what a run would load and match against it
ls spacetime.json 2>/dev/null && jq -r '.publish // .targets // {} | keys[]' spacetime.json
spacetime publish --no-config # bypass when targets do not match your args Prevention
- Run publish from the directory whose spacetime.json you expect
- Keep --server/--database arguments aligned with defined targets
- Use --no-config when intentionally publishing outside the config
When it happens
Trigger: `spacetime publish` with --server/--database (or other filter) arguments under which get_filtered_publish_configs returns zero targets from the loaded spacetime.json.
Common situations: spacetime.json targets bound to a different server than the one in --server; running publish in a directory whose spacetime.json belongs to another project; leftover configs after renaming databases or moving the project.
Related errors
- No database target matches '{}'. Available databases: {}
- Manual database migrations are not yet implemented
- Cannot use module-specific arguments ({}) when {}. {}
- Failed to parse config file {}: {}
- spacetime.json not found in {}
AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16).
Data as JSON: /api/errors/147358534b75d0e5.
Report an issue: GitHub.