databendlabs/databend · error

storage params is invalid for it's auto detect failed for

Error message

storage params is invalid for it's auto detect failed for {err:?}

What it means

After building `StorageParams` from the URI, the binder calls `.auto_detect()` which probes the storage backend (checks region, endpoint reachability, etc.). If that probing fails, the params are considered invalid and this error wraps the underlying cause. It usually means the configured endpoint/bucket is wrong or unreachable at plan time.

Solutions

  1. Inspect the wrapped `err:?` in the message for the concrete transport/region failure and fix that cause.
  2. Explicitly specify ENDPOINT_URL and REGION in the stage/location options instead of relying on auto-detection.
  3. Verify the bucket exists and is reachable from the query node (network, DNS, firewall, TLS).
  4. Ensure credentials are provided (or the node's storage config supplies valid ones) so the probe can authenticate.
  5. Test endpoint reachability with curl from the same node running the query.

Example fix

// before
URL = 's3://mybucket/data/'  -- relies on auto-detect, wrong region
// after
URL = 's3://mybucket/data/' ENDPOINT_URL = 'https://s3.us-east-1.amazonaws.com' REGION = 'us-east-1'
Defensive patterns

Strategy: try-catch

Try / catch

match parse_uri_location(&loc).await {
    Err(e) if e.to_string().contains("auto detect failed") => {
        // inspect wrapped cause, check endpoint/bucket/network, then retry with explicit ENDPOINT_URL/REGION
    }
    Err(e) => return Err(e),
    Ok(v) => v,
}

Prevention

When it happens

Trigger: Creating a stage or binding an external location where the resolved endpoint URL cannot be auto-detected: wrong region, non-existent bucket, unreachable custom endpoint, or missing credentials causing the probe to fail.

Common situations: Typo in bucket name, S3 bucket in a region different from the endpoint, on-prem MinIO/OSS endpoint behind a firewall or with a self-signed cert, DNS resolution failures inside the cluster.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of databendlabs/databend@288d84d76e (2026-09-11). Data as JSON: /api/errors/2ac8bebfef7416b1. Report an issue: GitHub.

Appendix: source

Thrown at src/query/sql/src/planner/binder/location.rs:664

    // Validate every endpoint URL exposed by the resolved StorageParams
    // (including secondary URLs such as OSS presign_endpoint_url) against the
    // egress policy. Centralising the check here keeps each per-scheme parser
    // free of policy knowledge and ensures new fields cannot silently bypass
    // it.
    //
    // Run before sp.auto_detect(): the S3 auto-detect branch contacts the
    // configured endpoint to discover the bucket region, so the policy must
    // gate that call as well. auto_detect only mutates `region`, not the
    // endpoint URL, so a single pre-check is sufficient.
    check_storage_params_endpoints(&sp)
        .await
        .map_err(|err| Error::new(ErrorKind::InvalidInput, err.to_string()))?;

    let sp = sp.auto_detect().await.map_err(|err| {
        Error::new(
            ErrorKind::InvalidInput,
            anyhow!("storage params is invalid for it's auto detect failed for {err:?}"),
        )
    })?;

    Ok((sp, path))
}

pub async fn get_storage_params_from_options(
    options: &BTreeMap<String, String>,
    resolved_connection: Option<UserDefinedConnection>,
) -> databend_common_exception::Result<StorageParams> {
    let location = options
        .get("location")
        .ok_or_else(|| ErrorCode::BadArguments("missing option 'location'".to_string()))?;
    let connection = options.get("connection_name");

    let mut location = if let Some(connection_name) = connection {
        let connection = resolved_connection.ok_or_else(|| {
            ErrorCode::BadArguments(format!(

View on GitHub (pinned to 288d84d76e)