xai-org/grok-build · error
No trace upload bucket configured. Set `GROK_TELEMETRY_GCS_B
Error message
No trace upload bucket configured. Set `GROK_TELEMETRY_GCS_BUCKET`, `GROK_TRACE_UPLOAD_BUCKET`, or `endpoints.trace_upload_bucket` in config for direct GCS uploads.
What it means
When the resolved upload method is Direct, the CLI needs a GCS bucket to upload traces into. If no bucket URL was resolved from `GROK_TELEMETRY_GCS_BUCKET`, `GROK_TRACE_UPLOAD_BUCKET`, or the `endpoints.trace_upload_bucket` config key, it bails. Proxy-managed uploads do not need a bucket; direct uploads do.
Source
Thrown at crates/codegen/xai-grok-pager/src/trace_cmd.rs:469
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);
if bucket_url.is_none()
&& matches!(
upload_method,
xai_grok_shell::session::repo_changes::UploadMethod::Direct { .. }
)
{
anyhow::bail!(
"No trace upload bucket configured. Set `GROK_TELEMETRY_GCS_BUCKET`, \
`GROK_TRACE_UPLOAD_BUCKET`, or `endpoints.trace_upload_bucket` in \
config for direct GCS uploads."
);
}
let bucket_display = bucket_url.as_deref().unwrap_or("proxy-managed");
let object_path = format!("{session_id}/trace_export.tar.gz");
let method_desc = UploadMethodDisplay {
method: &upload_method,
bucket_url: bucket_display,
}
.to_string();
let upload_config = xai_grok_shell::session::repo_changes::TraceExportConfig {
bucket_url: bucket_url.clone(),
service_account_key: None,
prefix_dir: None,
gcs_prefix: Some(session_id.to_string()),View on GitHub (pinned to bc7f02eddd)
Solutions
- Set `GROK_TRACE_UPLOAD_BUCKET` (or `GROK_TELEMETRY_GCS_BUCKET`) to your GCS bucket URL.
- Add `endpoints.trace_upload_bucket` to your grok config file.
- Or drop the direct-upload override so the proxy-managed path is used, which requires no bucket.
Example fix
// before grok trace upload --direct ... # no bucket configured // after export GROK_TRACE_UPLOAD_BUCKET=gs://my-traces-bucket grok trace upload --direct ...
Defensive patterns
Strategy: validation
Validate before calling
let has_bucket = std::env::var("GROK_TRACE_UPLOAD_BUCKET").is_ok()
|| std::env::var("GROK_TELEMETRY_GCS_BUCKET").is_ok()
|| config.endpoints.trace_upload_bucket.is_some();
if direct_upload && !has_bucket {
return Err("set GROK_TRACE_UPLOAD_BUCKET or endpoints.trace_upload_bucket for direct uploads".into());
} Prevention
- Set GROK_TRACE_UPLOAD_BUCKET wherever direct uploads are used.
- Keep `endpoints.trace_upload_bucket` in the shared config template.
- Prefer proxy-managed uploads when no bucket is available.
When it happens
Trigger: run_upload with a Direct UploadMethod (or forced direct) while bucket_url is None — none of the two env vars nor the config key are set.
Common situations: Forcing direct uploads in CI where only proxy settings exist; renaming/migrating config so `endpoints.trace_upload_bucket` disappeared; env vars set in one shell but not the service context.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- no target specified
- Invalid GCS URL scheme: expected 'gs', got '{}'
- {LOCAL_WORKSPACE_REQUIRES_CHAT}
- No upload credentials. Run `grok login` or set a deployment
- deny glob {glob:?} uses unsupported metacharacter '{c}' (bra
AI-assisted analysis of xai-org/grok-build@bc7f02eddd (2026-08-31).
Data as JSON: /api/errors/2ae4d4e2c3e3448d.
Report an issue: GitHub.