{"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":"info","filePath":"crates/cli/src/subcommands/publish.rs","lineNumber":576,"sourceCode":"                path_to_project\n                    .as_ref()\n                    .expect(\"path_to_project must exist when publishing from source\"),\n                &build_options,\n                native_aot,\n                dotnet_version,\n            )\n            .await?\n        };\n        let program_bytes = fs::read(path_to_program)?;\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        let client = reqwest::Client::new();\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);\n            let mut builder = client.put(format!(\"{database_host}/v1/database/{domain}\"));\n\n            // note that this only happens in the case where we've passed a `name_or_identity`, but that's required if we pass `--clear-database`.","sourceCodeStart":558,"sourceCodeEnd":594,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/cli/src/subcommands/publish.rs#L558-L594","documentation":"Before uploading, `spacetime publish` extracts the server address from the resolved database host URL. If it is anything other than `localhost` or `127.0.0.1`, the CLI prints 'You are about to publish to a non-local server' and prompts y/N. `y_or_n` returns true only for literal `y`/`yes` (or when a force/`--yes` flag short-circuits it); anything else — including EOF on a closed stdin — bails with this error.","triggerScenarios":"Running `spacetime publish` (or `spacetime generate`/deploy flows that reuse it) while the active server URL points at a remote host (e.g. maincloud/testnet), then answering 'n', pressing Enter on the empty default, or running non-interactively so stdin returns EOF at the prompt.","commonSituations":"Switching `spacetime server set-default` to a remote server and forgetting the confirmation now appears; CI/scripts invoking publish without `--yes` so the prompt reads EOF and aborts; genuinely intending local dev but the URL uses a LAN IP or hostname instead of localhost.","solutions":["Re-run the command and answer `y` at the prompt if the remote target is intended","Pass the global `--yes` flag (maps to `yes.publish_to_remote`) to auto-confirm remote publishing in scripts","Verify you are targeting the intended server with `spacetime server list` / `spacetime server ping`, and switch back to localhost if you meant local development","Ensure stdin is a TTY or supply `--yes` when automating, since EOF counts as 'no'"],"exampleFix":"# before\nspacetime publish -s https://server.spacetimedb.com mydb   # prompt -> aborted\n# after\nspacetime publish -s https://server.spacetimedb.com --yes mydb","handlingStrategy":"validation","validationCode":"# Before publishing, resolve and check the host yourself\nurl=\"$(spacetime server list 2>/dev/null | awk '/\\*/{print $2}')\"  # or however you capture it\ncase \"$url\" in *localhost*|*127.0.0.1*) ;; *) echo \"remote target: $url\" ;; esac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass `--yes` (and intent-specific force flags) when running `spacetime publish` in CI so prompts can't read EOF and abort","Verify the active server with `spacetime server list` before publishing","Treat a sudden remote-publish prompt as a signal your default server changed"],"tags":["spacetimedb","publish","confirmation","remote-server","cli"],"backgroundTag":"user-aborted-confirmation","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}