xai-org/x-algorithm · error · anyhow::Error
Failed to check object existence: {}
Error message
Failed to check object existence: {} What it means
Raised in the O2 wrapper's exists() when store.head(path) fails with an error other than NotFound. head() is being used to test object existence, so any non-NotFound failure (auth, network, malformed path, permission) surfaces as this generic message.
Source
Thrown at thunder/o2/mod.rs:116
let path = self.full_path(key);
let result = self
.store
.get(&path)
.await
.with_context(|| format!("Failed to get object: {}", path))?;
let bytes = result
.bytes()
.await
.with_context(|| format!("Failed to read object bytes: {}", path))?;
Ok(bytes)
}
pub async fn exists(&self, key: &str) -> Result<bool> {
let path = self.full_path(key);
match self.store.head(&path).await {
Ok(_) => Ok(true),
Err(object_store::Error::NotFound { .. }) => Ok(false),
Err(e) => Err(anyhow!("Failed to check object existence: {}", e)),
}
}
pub async fn delete(&self, key: &str) -> Result<()> {
let path = self.full_path(key);
self.store
.delete(&path)
.await
.with_context(|| format!("Failed to delete object: {}", path))?;
Ok(())
}
pub async fn list(&self, key_prefix: &str) -> Result<Vec<String>> {
let path = self.full_path(key_prefix);
let prefix_str = format!("{}/", self.prefix);
let objects: Vec<_> = self
.storeView on GitHub (pinned to 24c60942c5)
Solutions
- Check credentials and permissions for the bucket/prefix used by full_path(key)
- Print and validate the fully-qualified path (full_path output) for malformed keys
- Retry once with backoff for transient network errors before surfacing
- Verify the object store URL scheme/bucket config (region, endpoint) matches the environment
Example fix
// before
if store.exists(key).await? { ... }
// after
let path = format_full_path(key);
tracing::debug!("HEAD {path}");
match store.exists(key).await {
Ok(true) => { /* proceed */ }
Ok(false) => { /* missing */ }
Err(e) if is_transient(&e) => { /* retry once */ }
Err(e) => return Err(anyhow!("exists({path}) failed: {e}")),
} Defensive patterns
Strategy: retry
Validate before calling
// validate key before calling exists: no leading '/', no '..'; preflight store credentials
Try / catch
match store.exists(key).await { Err(e) if is_transient(&e) => retry_once(...).await, r => r } Prevention
- Keep object-store creds fresh and scoped to the bucket
- Wrap HEAD failures with path context for debuggability
- Add retry-with-jitter at the storage adapter layer
When it happens
Trigger: Calling exists(key) when the object store returns an error on HEAD: invalid credentials, bucket not accessible, DNS/network failure to S3/GCS/Azure, or an invalid object path produced by full_path(key).
Common situations: Missing/expired cloud credentials (AWS keys, GCP SA); wrong bucket or region in the store URL; network egress blocked from the container; key strings with characters that break path encoding.
Related errors
- Failed to create consumer for thread {}: {:#}
- Not implemented: to_thrift for KeywordMatch
- Not implemented: to_thrift for SafetyResult
- Not implemented: to_thrift for Action
- Not implemented: to_thrift for DropReason
AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28).
Data as JSON: /api/errors/a9699b9393aa21cd.
Report an issue: GitHub.