xai-org/grok-build · error

{e}

Error message

{e}

What it means

In `cmd_install`, when installing a plugin from a Git source fails, the error from the underlying install operation is re-thrown verbatim via `bail!("{e}")`. Because the failure kind is unknown at this layer, the telemetry event is logged as InstallKind::Git with success=false, and the original error message from the install machinery is surfaced to the caller unchanged.

Solutions

  1. Read the embedded inner error message for the actual cause (clone failure, auth, manifest)
  2. Verify the git URL/SSH remote is reachable: git ls-remote <url>
  3. Configure git credentials (SSH keys or HTTPS token) for private repos
  4. Retry after network issues; if the plugin exists in the marketplace, use marketplace install instead

Example fix

// before
grok plugin install github.com/my-org/my-plugin

// after (verify remote first)
git ls-remote https://github.com/my-org/my-plugin && \
  grok plugin install https://github.com/my-org/my-plugin
Defensive patterns

Strategy: try-catch

Validate before calling

// verify reachability before install
git ls-remote <repo-url> > /dev/null 2>&1 || echo "repo unreachable or auth missing"

Type guard

fn is_git_source(src: &str) -> bool {
    src.ends_with(".git") || src.starts_with("https://") || src.starts_with("git@") || src.starts_with("ssh://")
}

Try / catch

match install_result {
    Err(e) => {
        eprintln!("Plugin install failed: {e}");
        // classify: network vs auth vs manifest by inspecting e
    }
    Ok(p) => println!("installed {}", p.name()),
}

Prevention

When it happens

Trigger: Running `grok plugin install <git-url-or-spec>` where the git clone, checkout, or manifest load fails; the underlying error (network failure, bad URL, missing repo, invalid plugin manifest) propagates up through this bail.

Common situations: Private repos without credentials configured; typos in git URLs; offline environments or blocked network egress; repos missing a valid plugin manifest at the expected location.

Related errors


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

Appendix: source

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

                tracing::warn!("{w}");
            }
            log_plugin_installed(install_kind(!outcome.is_local), true, None);
            println!(
                "Installed {} plugin(s) from {source}: {}",
                outcome.plugin_names.len(),
                outcome.plugin_names.join(", "),
            );
            Ok(())
        }
        Err(e) => {
            let cat = plugin::classify_install_error(&e);
            // On failure we don't know the kind; default to Git (matches canonical).
            log_plugin_installed(
                xai_grok_telemetry::events::InstallKind::Git,
                false,
                Some(cat),
            );
            bail!("{e}");
        }
    }
}

fn cmd_install_marketplace(
    source: &str,
    mref: &xai_grok_plugin_marketplace::install_resolve::MarketplaceRef,
    trust: bool,
) -> Result<()> {
    if !trust {
        let from = match &mref.qualifier {
            Some(qualifier) => match plugin::resolve_qualified_source_name(qualifier) {
                Ok(_display) => qualifier.clone(),
                Err(e) => bail!("{e}"),
            },
            None => match plugin::resolve_marketplace_source_name(&mref.name, None) {
                Ok(display) => display,
                Err(e) => bail!("{e}"),

View on GitHub (pinned to bc7f02eddd)