{"record":{"id":"43189ddfc5b134b6","repo":"apache/beam","slug":"stagingbucketname-must-end-with-snowflakewriteconfiguration","errorCode":null,"errorMessage":"stagingBucketName must end with '/'","messagePattern":"stagingBucketName must end with '/'","errorType":"validation","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/SnowflakeWriteConfiguration.java","lineNumber":139,"sourceCode":"\n  public static Builder builder() {\n    return new AutoValue_SnowflakeWriteConfiguration.Builder();\n  }\n\n  public abstract Builder toBuilder();\n\n  void validate() {\n    requireNonEmpty(getServerName(), \"serverName\");\n    requireNonEmpty(getDatabase(), \"database\");\n    requireNonEmpty(getSchema(), \"schema\");\n    requireNonEmpty(getStagingBucketName(), \"stagingBucketName\");\n    requireNonEmpty(getStorageIntegrationName(), \"storageIntegrationName\");\n\n    SnowflakeSchemaTransformUtils.validateAuthentication(\n        getUsername(), getPassword(), getOauthToken(), getPrivateKey(), getPrivateKeyPassphrase());\n\n    if (!getStagingBucketName().endsWith(\"/\")) {\n      throw new IllegalArgumentException(\"stagingBucketName must end with '/'\");\n    }\n\n    // Parse configured enum values to validate that they are supported.\n    String createDisposition = getCreateDisposition();\n    if (createDisposition != null) {\n      parseCreateDisposition(createDisposition);\n    }\n\n    String writeDisposition = getWriteDisposition();\n    if (writeDisposition != null) {\n      parseWriteDisposition(writeDisposition);\n    }\n\n    String debugMode = getDebugMode();\n    if (debugMode != null) {\n      parseStreamingLogLevel(debugMode);\n    }\n","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/SnowflakeWriteConfiguration.java#L121-L157","documentation":"SnowflakeWriteConfiguration.validate() requires the staging bucket name to end with a trailing slash. The Snowflake IO composes storage integration paths by directly appending to the staging bucket name, so a missing trailing slash would produce malformed GCS/S3 paths during COPY operations. The check runs eagerly at pipeline construction time via IllegalArgumentException.","triggerScenarios":"Calling SnowflakeWriteConfiguration (or the Snowflake write SchemaTransform) with stagingBucketName set to e.g. 'gs://my-bucket' or 'gs://my-bucket/prefix' instead of 'gs://my-bucket/' or 'gs://my-bucket/prefix/'.","commonSituations":"Users copy a bucket URL from the cloud console (which omits the trailing slash) or construct the path programmatically with string concatenation and forget the separator; very common in Terraform-generated or template-generated configs.","solutions":["Append a '/' to the staging bucket name, e.g. change 'gs://my-bucket' to 'gs://my-bucket/'.","If the value comes from a config file or pipeline option, sanitize it before building the configuration (value.endsWith(\"/\") ? value : value + \"/\").","Check the storage integration in Snowflake points at the same bucket root if paths still misbehave after the fix."],"exampleFix":"// before\n.withStagingBucketName(\"gs://my-snowflake-bucket\")\n// after\n.withStagingBucketName(\"gs://my-snowflake-bucket/\")","handlingStrategy":"validation","validationCode":"String bucket = cfg.getStagingBucketName();\nif (bucket != null && !bucket.endsWith(\"/\")) {\n  bucket = bucket + \"/\";\n}","typeGuard":null,"tryCatchPattern":"try {\n  config.validate();\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"stagingBucketName\")) { /* fix trailing slash and retry */ }\n  throw e;\n}","preventionTips":["Normalize bucket strings with a small helper that guarantees a trailing slash before building the configuration.","Store bucket paths in config with the trailing slash already included and document this convention.","Run configuration.validate() in unit tests with production config fixtures."],"tags":["java","configuration","beam-io","snowflake"],"backgroundTag":"invalid-config-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}