xai-org/grok-build · error

No upload credentials. Run `grok login` or set a deployment

Error message

No upload credentials. Run `grok login` or set a deployment key. See {} for upload overrides.

What it means

The trace upload command requires credentials to authenticate uploads. When no upload method can be resolved (no login session and no deployment key), it warns and bails, directing the user to docs for override configuration. Without credentials the CLI cannot authenticate an upload request.

Source

Thrown at crates/codegen/xai-grok-pager/src/trace_cmd.rs:444

    session_id: &str,
    output: Option<&Path>,
    json: bool,
    agent_config: &AgentConfig,
) -> Result<()> {
    let session_dir = find_session_dir(session_id)?;
    if !json {
        eprintln!("Found session at: {}", session_dir.display());
    }

    let upload_method = resolve_upload_method(agent_config).await;
    let upload_method = match upload_method {
        Some(method) => method,
        None => {
            tracing::warn!(
                session_id = %session_id,
                "trace_cmd: no upload credentials available"
            );
            anyhow::bail!(
                "No upload credentials. Run `grok login` or set a deployment key. \
                 See {} for upload overrides.",
                crate::util::display_user_grok_path("docs/user-guide")
            );
        }
    };

    if !json {
        eprintln!("Building session trace archive...");
    }
    let archive = build_session_tar(&session_dir, session_id, agent_config)?;
    let archive_size = archive.len();

    // Proxy-mode uploads don't need a bucket (the proxy owns the destination); direct GCS uploads do
    let bucket_url = agent_config
        .endpoints
        .resolve_trace_bucket_url()
        .map(|r| r.value);

View on GitHub (pinned to bc7f02eddd)

Solutions

  1. Run `grok login` to establish credentials.
  2. Set a deployment key in the environment for non-interactive use.
  3. Consult the docs path printed in the error (docs/user-guide, resolved via the user grok path) for upload override options.

Example fix

// before
grok trace upload ...
// error: No upload credentials
// after (CI)
export GROK_DEPLOYMENT_KEY=...  # or pre-run `grok login`
grok trace upload ...
Defensive patterns

Strategy: validation

Validate before calling

// ensure credentials exist before uploading
if !std::path::Path::new(&grok_auth_path()).exists()
    && std::env::var("GROK_DEPLOYMENT_KEY").is_err()
{
    return Err("run `grok login` or set a deployment key before trace upload".into());
}

Try / catch

match cmd.status() {
    Err(e) => eprintln!("trace upload failed: {e}"),
    Ok(s) if !s.success() => eprintln!("trace upload failed (missing credentials?) — run `grok login`"),
    Ok(_) => {}
}

Prevention

When it happens

Trigger: Running `grok trace upload` (run_upload) in an environment where no `grok login` session exists and no deployment key is configured, so the upload-method resolution returns None.

Common situations: CI/CD containers without an interactive login; fresh machines; running as a service user without the auth state; expired login state treated as absent.

Related errors


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