apache/flink · error · FlinkRuntimeException

Error in s3 aws URI - {}

Error message

Error in s3 aws URI - {}

What it means

S3FileSystemFactory.createURI wraps java.net.URISyntaxException in a FlinkRuntimeException when the configured S3 URI/endpoint string cannot be parsed by java.net.URI. This is a hard configuration error raised during factory/filesystem initialization, before any S3 traffic happens.

Source

Thrown at flink-filesystems/flink-s3-fs-presto/src/main/java/org/apache/flink/fs/s3presto/S3FileSystemFactory.java:120

        } else if (scheme != null && authority == null) {
            initUri = createURI(scheme + "://s3.amazonaws.com");
        } else {
            initUri = fsUri;
        }
        return initUri;
    }

    @Nullable
    @Override
    protected S3AccessHelper getS3AccessHelper(FileSystem fs) {
        return null;
    }

    private URI createURI(String str) {
        try {
            return new URI(str);
        } catch (URISyntaxException e) {
            throw new FlinkRuntimeException("Error in s3 aws URI - " + str, e);
        }
    }
}

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Fix the URI string: scheme://host:port, percent-encode spaces and special characters, wrap IPv6 literals in brackets ([::1]:9000).
  2. Validate config early: new URI(endpoint) in a startup check or a ConfigOption validator so the job fails before submitting.
  3. Print the exact string in logs (it is included in the message) and diff it against the intended endpoint for hidden whitespace/quotes.
  4. Avoid env interpolation that can inject quotes; sanitize variables used inside s3.* properties.

Example fix

# before (flink-conf.yaml)
s3.endpoint: http://minio.myco internal:9000

# after
s3.endpoint: http://minio.myco-internal:9000
Defensive patterns

Strategy: validation

Validate before calling

try {
    new URI(endpoint);
} catch (URISyntaxException e) {
    throw new IllegalArgumentException("Bad s3.endpoint: '" + endpoint + "'", e);
}

Prevention

When it happens

Trigger: Setting s3.endpoint or scheme config values containing illegal URI characters — spaces, unencoded braces/brackets (IPv6 endpoints without brackets), a colon in the wrong place, backslashes, or control characters — so 'new URI(str)' fails.

Common situations: Endpoint URLs copy-pasted with trailing spaces or percent-encoding missing (e.g. 'http://minio:9000/path with space'); IPv6 literal endpoints not wrapped in brackets; Windows-style paths in config; env-var interpolation injecting quotes or newlines into the URI.

Related errors


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/f1e59e5a17c50502. Report an issue: GitHub.