{"record":{"id":"6133d137d3d01d0d","repo":"clockworklabs/SpacetimeDB","slug":"publish-aborted-by-user","errorCode":null,"errorMessage":"Publish aborted by user.","messagePattern":"Publish aborted by user\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"crates/cli/src/subcommands/publish.rs","lineNumber":704,"sourceCode":"            .await?\n        };\n        let program_bytes = environment::read_program(&path_to_program)?;\n        let module_schema = environment::inspect(&program_bytes, host_type).await?;\n        let environment = environment::resolve(\n            module_schema.environment(),\n            command_config.get_config_value(\"env\"),\n            |key| std::env::var_os(key),\n        )?;\n        print!(\"{}\", environment.display());\n\n        let server_address = {\n            let url = Url::parse(&database_host)?;\n            url.host_str().unwrap_or(\"<default>\").to_string()\n        };\n        if server_address != \"localhost\" && server_address != \"127.0.0.1\" {\n            println!(\"You are about to publish to a non-local server: {server_address}\");\n            if !y_or_n(yes.publish_to_remote, \"Are you sure you want to proceed?\")? {\n                anyhow::bail!(\"Publish aborted by user.\");\n            }\n        }\n\n        println!(\n            \"Uploading to {} => {}\",\n            server.unwrap_or(config.default_server_name().unwrap_or(\"<default>\")),\n            database_host\n        );\n\n        // The body contains secrets. Never replay it to a redirect destination.\n        let client = reqwest::Client::builder()\n            .redirect(reqwest::redirect::Policy::none())\n            .build()?;\n        // If a name was given, ensure to percent-encode it.\n        // We also use PUT with a name or identity, and POST otherwise.\n        let mut builder = if let Some(name_or_identity) = name_or_identity {\n            let encode_set = const { &percent_encoding::NON_ALPHANUMERIC.remove(b'_').remove(b'-') };\n            let domain = percent_encoding::percent_encode(name_or_identity.as_bytes(), encode_set);","sourceCodeStart":686,"sourceCodeEnd":722,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/eddf9f5014579a50d4b67630e28b6e15cad9c4af/crates/cli/src/subcommands/publish.rs#L686-L722","documentation":"Before uploading a module, `spacetime publish` resolves the target database host and, when it is anything other than localhost/127.0.0.1, prints 'You are about to publish to a non-local server' and asks 'Are you sure you want to proceed?'. This error means the prompt was declined (answer other than 'y'), so nothing was uploaded. It is a safety gate against accidentally pushing modules to a shared or production server.","triggerScenarios":"`spacetime publish` (or `spacetime generate`, which shares this path) where the host resolved from --server, the CLI config default, or the database URL is not localhost/127.0.0.1, run without `--yes=remote`/`--yes=all`, and the user answers 'n' at the confirmation prompt.","commonSituations":"Default server previously switched to maincloud/testnet/production via `spacetime server set-default`; CI or non-interactive shells where stdin is closed so y_or_n reads as 'no'; forgetting the --yes flag in automation scripts.","solutions":["Re-run the command and answer 'y' at the prompt if the remote target is intended.","Pass `--yes=remote` (or `--yes=all`) to skip this specific prompt in automation.","If the remote target is NOT intended, publish with `--server local` or run `spacetime server set-default local` first.","In CI, always pass the appropriate `--yes=...` value because there is no TTY to confirm on."],"exampleFix":"# before (declines prompt -> error)\nspacetime publish mydb\n# after (intended remote publish)\nspacetime publish mydb --yes=remote\n# or, if local was intended\nspacetime publish mydb --server local","handlingStrategy":"validation","validationCode":"# Resolve the target host before publishing; only prompt-free publish when it is intended\nSERVER_URL=$(spacetime server list 2>/dev/null | grep -E '^\\*' | awk '{print $NF}')\ncase \"$SERVER_URL\" in *localhost*|*127.0.0.1*) ;; *) EXTRA=\"--yes=remote\" ;; esac\nspacetime publish mydb $EXTRA","typeGuard":null,"tryCatchPattern":"std::process::Command::new(\"spacetime\").args([\"publish\", db]) ... on non-zero exit, if stderr contains \"Publish aborted by user\" treat as a deliberate cancel (exit 0 semantics), not a pipeline failure","preventionTips":["Always pass an explicit --server or --yes value in scripts; never rely on a TTY prompt in CI.","Check `spacetime server list` output before publish to confirm which host will receive the module.","Treat this specific message as a cancellation signal in wrappers, distinct from real failures."],"tags":["publish","confirmation","remote-server","cli","interactive-prompt"],"backgroundTag":"cli-confirmation-declined","analyzedSha":"eddf9f5014579a50d4b67630e28b6e15cad9c4af","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}