xai-org/grok-build · error

devbox login is not available in this build (compiled withou

Error message

devbox login is not available in this build (compiled without the `devbox-login` feature)

What it means

In builds compiled without the `devbox-login` feature, devbox_login_stub provides mint_devbox_auth which unconditionally bails with the UNAVAILABLE message. It is a compile-time stub: real devbox auth code is feature-gated out, so this path always fails defensively even though is_devbox_environment would normally prevent reaching it.

Source

Thrown at crates/codegen/xai-grok-shell/src/auth/devbox_login_stub.rs:25

//! points that can still be reached directly (`grok login --devbox`) return a
//! descriptive error.

use super::manager::AuthManager;
use super::model::GrokAuth;

const UNAVAILABLE: &str =
    "devbox login is not available in this build (compiled without the `devbox-login` feature)";

/// Always `false` without the devbox auth feature; callers treat the
/// process as running outside a devbox environment.
pub(crate) fn is_devbox_environment() -> bool {
    false
}

/// Unreachable in practice (guarded by [`is_devbox_environment`]); errors
/// defensively if called.
pub(crate) async fn mint_devbox_auth(_auth_manager: &AuthManager) -> anyhow::Result<GrokAuth> {
    anyhow::bail!(UNAVAILABLE)
}

/// Unreachable in practice (guarded by [`is_devbox_environment`]); errors
/// defensively if called.
pub(super) async fn mint_devbox_auth_raw() -> anyhow::Result<GrokAuth> {
    anyhow::bail!(UNAVAILABLE)
}

/// `grok login --devbox` entry point: always errors in this build.
pub(crate) async fn run_devbox_login(
    _config: &crate::agent::config::Config,
) -> anyhow::Result<GrokAuth> {
    anyhow::bail!(UNAVAILABLE)
}

View on GitHub (pinned to bc7f02eddd)

Solutions

  1. Rebuild with the feature enabled: cargo build --features devbox-login
  2. Use an alternative auth method: `grok login` or set XAI_API_KEY
  3. Verify is_devbox_environment detection — if you're NOT in a devbox, don't request devbox auth
  4. Check your install is the devbox variant of the binary, not the production one

Example fix

// before
cargo build --release
// after
cargo build --release --features devbox-login
Defensive patterns

Strategy: fallback

Validate before calling

// Detect stub build at runtime before attempting devbox auth
// (message check) or prefer env-key auth when available
if std::env::var("XAI_API_KEY").is_ok() {
    // use API-key auth path instead of devbox login
}

Try / catch

match mint_devbox_auth(&auth_manager).await {
    Ok(auth) => auth,
    Err(e) if e.to_string().contains("not available in this build") => {
        eprintln!("build lacks devbox-login; falling back to API key");
        auth_from_api_key().await?
    },
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling mint_devbox_auth on a binary built without the `devbox-login` cargo feature, i.e. any code path that requests devbox authentication from AuthManager in a non-feature build.

Common situations: Running in a devbox environment with a production/release build that omitted the feature flag, or a misconfigured build pipeline that dropped `--features devbox-login`.

Related errors


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