t8y2/dbx · error

unsupported file URI scheme: %s

Error message

unsupported file URI scheme: %s

What it means

normalizeLocalFilePath (config_file.go:350) parses any path that looks like a URI (contains '://' or starts with 'file:') and requires the scheme to be `file`. URLs with other schemes (http://, https://, s3://, hdfs://, jar:, etc.) are rejected because configuration file paths (TLS certs, Kerberos keytabs, JAAS configs) must be local files the driver can open directly.

Source

Thrown at agents/drivers/cassandra-go/config_file.go:350

	} else if ok {
		config.kerberos.useTicketCache = value
		config.kerberos.useTicketCacheSet = true
	}
	return nil
}

func normalizeLocalFilePath(raw string) (string, error) {
	value := strings.TrimSpace(raw)
	if value == "" {
		return "", nil
	}
	if strings.Contains(value, "://") || strings.HasPrefix(strings.ToLower(value), "file:") {
		parsed, err := url.Parse(value)
		if err != nil {
			return "", err
		}
		if parsed.Scheme != "file" {
			return "", fmt.Errorf("unsupported file URI scheme: %s", parsed.Scheme)
		}
		if parsed.Host != "" && !strings.EqualFold(parsed.Host, "localhost") {
			return "", fmt.Errorf("remote file URI hosts are not supported: %s", parsed.Host)
		}
		value, err = url.PathUnescape(parsed.Path)
		if err != nil {
			return "", err
		}
		if runtime.GOOS == "windows" && len(value) >= 3 && value[0] == '/' && value[2] == ':' {
			value = value[1:]
		}
	}
	return filepath.Clean(filepath.FromSlash(value)), nil
}

func hoconString(config *hocon.Config, path string) (string, bool, error) {
	if config.Get(path) == nil {
		return "", false, nil

View on GitHub (pinned to c0390bff16)

Solutions

  1. Download the file locally first (e.g. `curl -o ca.pem https://example.com/ca.pem`) and pass the local path `file:///etc/ssl/ca.pem` or `/etc/ssl/ca.pem`.
  2. Use the `file:` URI scheme if a URI is required: `file:///path/to/file` (host must be empty or 'localhost').
  3. For Kerberos keytabs/ccache, fetch them with your deployment tooling before the driver starts and reference local paths.
  4. If you don't intend a URI, remove any '://' or leading 'file:' from the string and pass a plain filesystem path.

Example fix

// before
caPath := "https://internal.example.com/pki/cassandra-ca.pem"
// after
cert, err := fetchToFile("https://internal.example.com/pki/cassandra-ca.pem", "/tmp/cassandra-ca.pem") // download first
if err != nil { log.Fatal(err) }
caPath := "/tmp/cassandra-ca.pem"
Defensive patterns

Strategy: validation

Validate before calling

func validateLocalFileURI(raw string) error {
    v := strings.TrimSpace(raw)
    if v == "" || !(strings.Contains(v, "://") || strings.HasPrefix(strings.ToLower(v), "file:")) {
        return nil
    }
    u, err := url.Parse(v)
    if err != nil {
        return err
    }
    if u.Scheme != "file" {
        return fmt.Errorf("scheme %q not supported; stage the file locally or use file://", u.Scheme)
    }
    return nil
}

Type guard

func isFileURI(raw string) bool {
    u, err := url.Parse(strings.TrimSpace(raw))
    return err == nil && strings.Contains(raw, "://") && u.Scheme == "file"
}

Try / catch

if err := applyCassandraConfigFile(cfgPath); err != nil {
    var schemeErr = "unsupported file URI scheme"
    if strings.Contains(err.Error(), schemeErr) {
        log.Fatalf("download remote artifacts before startup and pass a local file:// path")
    }
    return err
}

Prevention

When it happens

Trigger: Passing a value like `https://example.com/ca.pem`, `s3://bucket/keytab`, `hdfs://nn/keytab`, or `http://host/file` as a config-file path option (dbx.cassandra.tls.*-path, kerberos.keytab, kerberos.config, etc.) or inside the parsed config file; applyCassandraConfigFile and normalizeKerberos* call this.

Common situations: Config templated from an environment where cert paths are URLs served by a secrets manager; someone assuming remote fetch support; using object-storage URIs copied from Hadoop/Spark configs.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/993c4d8c7cdb141d. Report an issue: GitHub.