{"record":{"id":"147358534b75d0e5","repo":"clockworklabs/SpacetimeDB","slug":"no-matching-target-found-in-spacetime-json-for-the","errorCode":null,"errorMessage":"No matching target found in spacetime.json for the provided arguments. Use --no-config to ignore the config file.","messagePattern":"No matching target found in spacetime\\.json for the provided arguments\\. Use --no-config to ignore the config file\\.","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/subcommands/publish.rs","lineNumber":421,"sourceCode":"            && args.contains_id(\"module_path\")\n            && let Some(module_path) = args.get_one::<PathBuf>(\"module_path\")\n        {\n            owned_loaded = find_and_load_with_env_from(env, module_path.clone())?;\n        }\n\n        owned_loaded.as_ref().inspect(|loaded| {\n            if !quiet_config {\n                for path in &loaded.loaded_files {\n                    println!(\"Using configuration from {}\", path.display());\n                }\n            }\n        })\n    };\n\n    let (using_config, publish_configs) = if let Some(loaded) = loaded_config_ref {\n        let filtered = get_filtered_publish_configs(&loaded.config, &cmd, &schema, args)?;\n        if filtered.is_empty() {\n            anyhow::bail!(\n                \"No matching target found in spacetime.json for the provided arguments. \\\n                 Use --no-config to ignore the config file.\"\n            );\n        }\n        (true, filtered)\n    } else {\n        (\n            false,\n            vec![CommandConfig::new(&schema, std::collections::HashMap::new(), args)?],\n        )\n    };\n\n    let clear_database = args\n        .get_one::<ClearMode>(\"clear-database\")\n        .copied()\n        .unwrap_or(ClearMode::Never);\n    let yes = yes_flags_from_args(args);\n    let config_dir = loaded_config_ref.map(|lc| lc.config_dir.as_path());","sourceCodeStart":403,"sourceCodeEnd":439,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/cli/src/subcommands/publish.rs#L403-L439","documentation":"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.","triggerScenarios":"`spacetime publish` with --server/--database (or other filter) arguments under which get_filtered_publish_configs returns zero targets from the loaded spacetime.json.","commonSituations":"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.","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"],"exampleFix":"// before\nspacetime publish --server https://other.example.com\n// after: align with spacetime.json, or bypass it\nspacetime publish --no-config --server https://other.example.com","handlingStrategy":"validation","validationCode":"# see what a run would load and match against it\nls spacetime.json 2>/dev/null && jq -r '.publish // .targets // {} | keys[]' spacetime.json\nspacetime publish --no-config   # bypass when targets do not match your args","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["publish","spacetime-json","config","target-matching"],"backgroundTag":"config-target-not-found","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}