jdx/mise · error

S3 URL must include bucket name

Error message

S3 URL must include bucket name

What it means

S3Url::parse requires both a bucket (URL host) and a non-empty bucket name. This second check fires when the host parses but is empty, guaranteeing the backend always has an addressable bucket before any S3 request is built.

Solutions

  1. Include the bucket in the URL: s3://my-bucket/key
  2. Fix the templating/env var that produced an empty bucket name
  3. Validate the URL before handing it to mise

Example fix

// before
MISE_S3_URL=s3:///tools/mise.tar.gz
// after
MISE_S3_URL=s3://my-company-bucket/tools/mise.tar.gz
Defensive patterns

Strategy: validation

Validate before calling

// require a bucket before use
function hasBucket(s) { const m = s.match(/^s3:\/\/([^/]+)\//); return !!m && m[1].length > 0; }

Prevention

When it happens

Trigger: Passing an s3:// URL with no host portion that resolves to an empty bucket string, e.g. "s3:///key" or a malformed URL where the host component is blank after parsing.

Common situations: Hand-editing an s3:// URL and deleting the bucket; templated config where the bucket variable expanded to empty (unset env var); copy/paste truncation.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/1f93caf983d84978. Report an issue: GitHub.

Appendix: source

Thrown at src/backend/s3.rs:86

    key: String,
}

impl S3Url {
    /// Parse an S3 URL like "s3://bucket/path/to/object?region=us-west-2"
    fn parse(url_str: &str) -> Result<Self> {
        let url = Url::parse(url_str).map_err(|e| eyre!("Invalid S3 URL: {e}"))?;

        if url.scheme() != "s3" {
            bail!("URL must use s3:// scheme, got: {}", url.scheme());
        }

        let bucket = url
            .host_str()
            .ok_or_else(|| eyre!("S3 URL must include bucket name"))?
            .to_string();

        if bucket.is_empty() {
            bail!("S3 URL must include bucket name");
        }

        let key = url.path().trim_start_matches('/').to_string();

        Ok(Self { bucket, key })
    }
}

/// S3 backend for downloading tools from Amazon S3 or S3-compatible storage
#[derive(Debug)]
pub(crate) struct S3Backend {
    ba: Arc<BackendArg>,
    /// Cached S3 client, lazily initialized
    client: OnceCell<S3Client>,
}

#[derive(Debug, Clone, Copy)]
struct S3Options<'a> {

View on GitHub (pinned to 533346cc37)