{"record":{"id":"3efe02d56d5df358","repo":"apache/flink","slug":"bucket-name-in-s-is-invalid","errorCode":null,"errorMessage":"Bucket name in %s is invalid","messagePattern":"Bucket name in (.+?) is invalid","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-filesystems/flink-gs-fs-hadoop/src/main/java/org/apache/flink/fs/gs/utils/BlobUtils.java","lineNumber":53,"sourceCode":"\n    /** The maximum number of blobs that can be composed in a single operation. */\n    public static final int COMPOSE_MAX_BLOBS = 32;\n\n    /**\n     * Parses a blob id from a Google storage uri, i.e. gs://bucket/foo/bar yields a blob with\n     * bucket name \"bucket\" and object name \"foo/bar\".\n     *\n     * @param uri The gs uri\n     * @return The blob id\n     */\n    public static GSBlobIdentifier parseUri(URI uri) {\n        Preconditions.checkArgument(\n                uri.getScheme().equals(GSFileSystemFactory.SCHEME),\n                String.format(\"URI scheme for %s must be %s\", uri, GSFileSystemFactory.SCHEME));\n\n        String finalBucketName = uri.getAuthority();\n        if (StringUtils.isNullOrWhitespaceOnly(finalBucketName)) {\n            throw new IllegalArgumentException(String.format(\"Bucket name in %s is invalid\", uri));\n        }\n        String path = uri.getPath();\n        if (StringUtils.isNullOrWhitespaceOnly(path)) {\n            throw new IllegalArgumentException(String.format(\"Object name in %s is invalid\", uri));\n        }\n        String finalObjectName = path.substring(1); // remove leading slash from path\n        if (StringUtils.isNullOrWhitespaceOnly(finalObjectName)) {\n            throw new IllegalArgumentException(String.format(\"Object name in %s is invalid\", uri));\n        }\n        return new GSBlobIdentifier(finalBucketName, finalObjectName);\n    }\n\n    /**\n     * Returns the temporary bucket name. If options specifies a temporary bucket name, we use that\n     * one; otherwise, we use the bucket name of the final blob.\n     *\n     * @param finalBlobIdentifier The final blob identifier\n     * @param options The file system options","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-filesystems/flink-gs-fs-hadoop/src/main/java/org/apache/flink/fs/gs/utils/BlobUtils.java#L35-L71","documentation":"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.","triggerScenarios":"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.","commonSituations":"Building paths with 'gs://' + variable where the bucket variable is empty; misconfigured checkpoint/savepoint/output dir keys in flink-conf.yaml.","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"],"exampleFix":"// before\nString uri = \"gs:///\" + objectName; // bucket omitted\n\n// after\nString uri = String.format(\"gs://%s/%s\", bucketName, objectName);","handlingStrategy":"validation","validationCode":"java.net.URI uri = java.net.URI.create(candidate);\nif (uri.getAuthority() == null || uri.getAuthority().trim().isEmpty()) {\n    throw new IllegalArgumentException(\"gs URI must include a bucket: \" + candidate);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["gcs","uri","validation","configuration"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}