apache/flink · error · IllegalArgumentException
Bucket name in %s is invalid
Error message
Bucket name in %s is invalid
What it means
Thrown by BlobUtils.parseUri when a gs:// URI has no authority, i.e. no bucket name. The scheme is checked first, then the authority is validated; a null/whitespace authority means the URI cannot identify a blob and parsing aborts with IllegalArgumentException.
Source
Thrown at flink-filesystems/flink-gs-fs-hadoop/src/main/java/org/apache/flink/fs/gs/utils/BlobUtils.java:53
/** The maximum number of blobs that can be composed in a single operation. */
public static final int COMPOSE_MAX_BLOBS = 32;
/**
* Parses a blob id from a Google storage uri, i.e. gs://bucket/foo/bar yields a blob with
* bucket name "bucket" and object name "foo/bar".
*
* @param uri The gs uri
* @return The blob id
*/
public static GSBlobIdentifier parseUri(URI uri) {
Preconditions.checkArgument(
uri.getScheme().equals(GSFileSystemFactory.SCHEME),
String.format("URI scheme for %s must be %s", uri, GSFileSystemFactory.SCHEME));
String finalBucketName = uri.getAuthority();
if (StringUtils.isNullOrWhitespaceOnly(finalBucketName)) {
throw new IllegalArgumentException(String.format("Bucket name in %s is invalid", uri));
}
String path = uri.getPath();
if (StringUtils.isNullOrWhitespaceOnly(path)) {
throw new IllegalArgumentException(String.format("Object name in %s is invalid", uri));
}
String finalObjectName = path.substring(1); // remove leading slash from path
if (StringUtils.isNullOrWhitespaceOnly(finalObjectName)) {
throw new IllegalArgumentException(String.format("Object name in %s is invalid", uri));
}
return new GSBlobIdentifier(finalBucketName, finalObjectName);
}
/**
* Returns the temporary bucket name. If options specifies a temporary bucket name, we use that
* one; otherwise, we use the bucket name of the final blob.
*
* @param finalBlobIdentifier The final blob identifier
* @param options The file system optionsView on GitHub (pinned to 2f3c205e92)
Solutions
- Fix the URI to include the bucket: 'gs://my-bucket/path/object'
- Check the config value for sinks/checkpoints ('s3://'-style keys like state.checkpoints.dir) for a missing bucket segment
- Log the constructed URI before use when paths are assembled dynamically
Example fix
// before
String uri = "gs:///" + objectName; // bucket omitted
// after
String uri = String.format("gs://%s/%s", bucketName, objectName); Defensive patterns
Strategy: validation
Validate before calling
java.net.URI uri = java.net.URI.create(candidate);
if (uri.getAuthority() == null || uri.getAuthority().trim().isEmpty()) {
throw new IllegalArgumentException("gs URI must include a bucket: " + candidate);
} Prevention
- Build gs URIs from explicit bucket + object variables, never string slashes
- Unit-test path builders for empty bucket variables
- Lint flink-conf path options for gs:// URIs missing the authority
When it happens
Trigger: Passing a URI like 'gs:///path/object' (three slashes, empty bucket) to GSFileSystem/GSBlobStorage operations — typically from string-concatenated paths or Path.toUri round-trips on malformed inputs.
Common situations: Building paths with 'gs://' + variable where the bucket variable is empty; misconfigured checkpoint/savepoint/output dir keys in flink-conf.yaml.
Related errors
- Object name in %s is invalid
- Not allowed configuration change(s) were detected:\n - {erro
- At least one trigger condition must be configured.
- Unsupported serializer type %s for %s
- Value for config option %s must be one of %s (was %s)
AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14).
Data as JSON: /api/errors/3efe02d56d5df358.
Report an issue: GitHub.