xai-org/grok-build · error

Failed to push tag: {stderr}

Error message

Failed to push tag: {stderr}

What it means

After creating the tag, `grok plugin tag` runs `git push origin <tag>` and bails with 'Failed to push tag: {stderr}' when the push exits non-zero, surfacing git's stderr. This reports remote publishing failures.

Source

Thrown at crates/codegen/xai-grok-pager/src/plugin_cmd.rs:776

    }
    let out = cmd.current_dir(&root).output()?;
    if !out.status.success() {
        bail!(
            "Failed to create tag: {}",
            String::from_utf8_lossy(&out.stderr)
        );
    }
    println!("Created tag: {tag}");

    if push {
        let mut push_cmd = std::process::Command::new("git");
        push_cmd.args(["push", "origin", &tag]);
        if force {
            push_cmd.arg("--force");
        }
        let out = push_cmd.current_dir(&root).output()?;
        if !out.status.success() {
            bail!(
                "Failed to push tag: {}",
                String::from_utf8_lossy(&out.stderr)
            );
        }
        println!("Pushed tag {tag} to origin.");
    }
    Ok(())
}

// ── Marketplace subcommands ─────────────────────────────────────────

async fn run_marketplace(cmd: MarketplaceCommand) -> Result<()> {
    let config = xai_grok_shell::config::load_effective_config()
        .ok()
        .unwrap_or(toml::Value::Table(toml::map::Map::new()));
    let mut sources = xai_grok_plugin_marketplace::load_sources(&config);
    sources.extend(xai_grok_plugin_marketplace::load_extra_sources_from_settings(&sources));

View on GitHub (pinned to bc7f02eddd)

Solutions

  1. Verify the remote exists: `git remote -v`, and add it if missing (`git remote add origin <url>`)
  2. Authenticate: run `git fetch origin` to trigger credential setup, or load your SSH key with `ssh-add`
  3. If the tag already exists remotely, re-run with `--force` (or delete it remotely first)
  4. Push manually with `git push origin <tag>` to see the full git error

Example fix

// before
grok plugin tag . --push     # ERROR: Permission to ... denied (publickey)
// after
ssh-add ~/.ssh/id_ed25519
grok plugin tag . --push
Defensive patterns

Strategy: retry

Validate before calling

fn can_push_to_origin(root: &std::path::Path) -> bool {
    std::process::Command::new("git")
        .args(["ls-remote", "--exit-code", "origin", "HEAD"])
        .current_dir(root)
        .output()
        .map(|o| o.status.success())
        .unwrap_or(false)
}
// verify remote reachability + auth before tagging with --push

Type guard

fn has_origin(root: &std::path::Path) -> bool {
    std::process::Command::new("git")
        .args(["remote", "get-url", "origin"])
        .current_dir(root)
        .output()
        .map(|o| o.status.success())
        .unwrap_or(false)
}

Try / catch

match cmd_tag(dir, true, false, false) {
    Err(e) if e.to_string().contains("Failed to push tag") => {
        eprintln!("Push failed ({e}); check auth/remote, then retry: git push origin <tag>");
    }
    Ok(_) => {}
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Running `grok plugin tag --push` where the remote rejects the push: no 'origin' remote, missing auth/credentials, remote already has the tag without --force, or no network.

Common situations: Repo cloned without push access; HTTPS credentials expired or SSH key not loaded (ssh-agent); tag already on remote from another machine; corporate proxy blocking git.

Related errors


AI-assisted analysis of xai-org/grok-build@bc7f02eddd (2026-08-31). Data as JSON: /api/errors/e36a68248bb1f1de. Report an issue: GitHub.