xai-org/grok-build · error

{e}

Error message

{e}

What it means

This error surfaces when the user pins an explicit version (--version) but the resolved VersionPolicy rejects that install target. auto_update.rs calls crate::version_policy::check_install_target(&policy, version) before installing, and any rejection is re-bailed verbatim with anyhow::bail!("{e}") so the policy's message propagates to the CLI user.

Source

Thrown at crates/codegen/xai-grok-update/src/auto_update.rs:2737

    };
    // Persist installer if not already saved
    let cfg = config::load_config().await;
    if cfg.cli.installer.is_none() {
        let _ = config::update_config(|st| {
            st.cli.installer = Some(installer.to_string());
        })
        .await;
    }

    heal_managed_install(installer).await;

    let current_version = get_installed_grok_version();
    let policy = config::VersionPolicy::resolve();

    // When --version is given, skip the latest-version check and install directly
    if let Some(version) = pinned_version {
        if let Err(e) = crate::version_policy::check_install_target(&policy, version) {
            anyhow::bail!("{e}");
        }
        eprintln!(
            "Installing Grok {} (current: {})...",
            version, current_version
        );
        eprintln!();
        run_install_script(installer, Some(version), update_config, trigger).await?;
        refresh_deployment_config().await;
        if let Err(e) = config::update_config(|st| {
            st.cli.auto_update = Some(false);
        })
        .await
        {
            tracing::warn!("Failed to persist auto_update=false for pinned install: {e}");
        }
        eprintln!("  ✓ grok v{} installed successfully!", version);
        eprintln!("  Please restart Grok.");
        return Ok(Some(version.to_string()));

View on GitHub (pinned to bc7f02eddd)

Solutions

  1. Read the propagated policy message; it states which policy check (minimum version, channel, etc.) the pinned version failed
  2. Remove the --version pin so the updater picks the latest allowed release
  3. Update the pinned version to one that satisfies the policy's minimum/allowed range
  4. Ask the administrator to relax the VersionPolicy in the deployment config if the older version is genuinely required

Example fix

// before
grok-update install --version 0.1.2   // below policy minimum -> bails
// after
grok-update install --version 0.9.0   // meets VersionPolicy minimum
# or omit --version entirely to install the latest allowed release
Defensive patterns

Strategy: validation

Validate before calling

// Validate the pinned version against policy before invoking the updater
let policy = xai_grok_update::config::VersionPolicy::resolve();
if let Err(policy_err) = xai_grok_update::version_policy::check_install_target(&policy, pinned_version) {
    eprintln!("Pinned version rejected by policy: {policy_err}");
    std::process::exit(2);
}

Try / catch

// Rust callers embedding the updater
match run_update(Some(pinned_version)).await {
    Ok(plan) => apply(plan),
    Err(e) if e.to_string().contains("policy") || is_policy_rejection(&e) => {
        eprintln!("Version pin violates policy: {e}"); // prompt for allowed version
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Running the updater with a pinned version while the resolved VersionPolicy (from deployment/enterprise config) forbids it — e.g. the pinned version is below the enforced minimum, violates channel rules, or is otherwise not an allowed install target per check_install_target.

Common situations: Admin-enforced minimum-version policies in managed environments; developers trying to downgrade to an older version that policy disallows; stale local config.toml pinning a version no longer permitted by refreshed deployment config.

Related errors


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