zellij-org/zellij · error
flag '--no-push' can only be used with '--cargo-registry'
Error message
flag '--no-push' can only be used with '--cargo-registry'
What it means
In `cargo xtask publish`, --no-push suppresses the git push step and is only meaningful when publishing to a custom registry selected with --cargo-registry. Using --no-push without --cargo-registry is rejected immediately (anyhow::bail!) before any publish work starts.
Source
Thrown at xtask/src/pipelines.rs:233
let remote = flags.git_remote.unwrap_or("origin".into());
let registry = if let Some(ref registry) = flags.cargo_registry {
Some(format!(
"--registry={}",
registry
.clone()
.into_string()
.map_err(|registry| anyhow::Error::msg(format!(
"failed to convert '{:?}' to valid registry name",
registry
)))
.context(err_context)?
))
} else {
None
};
let registry = registry.as_ref();
if flags.no_push && flags.cargo_registry.is_none() {
anyhow::bail!("flag '--no-push' can only be used with '--cargo-registry'");
}
sh.change_dir(crate::project_root());
let cargo = crate::cargo().context(err_context)?;
let project_dir = crate::project_root();
let manifest = sh
.read_file(project_dir.join("Cargo.toml"))
.context(err_context)?
.parse::<toml::Table>()
.context(err_context)?;
// Version of the core crate
let version = manifest
.get("workspace")
.and_then(|workspace| workspace.get("package"))
.and_then(|package| package["version"].as_str())
.context("failed to read package version from manifest")
.context(err_context)?;
View on GitHub (pinned to 98a0837077)
Solutions
- Add the registry: `cargo xtask publish --cargo-registry <name> --no-push`
- Or drop --no-push and run the normal publish flow (it pushes by default)
- Use `--dry-run` instead if the goal was to rehearse a publish without side effects; check `cargo xtask publish --help`
Example fix
# before cargo xtask publish --no-push # after cargo xtask publish --cargo-registry acme --no-push
Defensive patterns
Strategy: validation
Validate before calling
# enforce flag contract before invoking publish
if [[ -n "$NO_PUSH" && -z "$REGISTRY" ]]; then
echo "--no-push requires --cargo-registry <name>"; exit 2
fi
cargo xtask publish ${REGISTRY:+--cargo-registry "$REGISTRY"} ${NO_PUSH:+--no-push} Type guard
fn publish_flags_valid(no_push: bool, cargo_registry: Option<&str>) -> bool {
!no_push || cargo_registry.is_some()
} Prevention
- Model the invariant in wrappers: no-push implies registry
- Prefer --dry-run to rehearse publishes; reserve --no-push for registry workflows
- Check `cargo xtask publish --help` when scripting the release pipeline
When it happens
Trigger: Running `cargo xtask publish --no-push` without also passing --cargo-registry.
Common situations: Trying a dry-run-like local publish without reading the flag contract; scripts carrying --no-push over from a registry workflow into the default crates.io flow.
Related errors
- either '--build' or '--test' must be provided!
- flags '--build' and '--test' are mutually exclusive!
- !!! cargo make has been deprecated by zellij !!! Our build
- Swap Layout not found for: {}
AI-assisted analysis of zellij-org/zellij@98a0837077 (2026-08-16).
Data as JSON: /api/errors/d0d1a93331a323de.
Report an issue: GitHub.