apache/beam · error · java.lang.RuntimeException

Failed to setLoginTimeout

Error message

Failed to setLoginTimeout

What it means

If dataSource.setLoginTimeout(int) throws SQLException while configuring the Snowflake data source, SnowflakeIO rethrows it as RuntimeException('Failed to setLoginTimeout'). The underlying SQLException detail is discarded, so only the driver-level failure to apply the timeout is reported.

Solutions

  1. Pass a non-negative integer login timeout (e.g. 30 seconds or more).
  2. Check the pipeline option feeding getLoginTimeout() for stray characters/negative values.
  3. Update the Snowflake JDBC driver (net.snowflake:snowflake-jdbc) to a current version.
  4. If the timeout isn't essential, remove .withLoginTimeout(...) to unblock the pipeline.

Example fix

// before
.withLoginTimeout(-1) // invalid
// after
.withLoginTimeout(30)
Defensive patterns

Strategy: validation

Validate before calling

if (loginTimeout != null && loginTimeout <= 0) {
  throw new IllegalArgumentException("loginTimeout must be a positive integer");
}

Prevention

When it happens

Trigger: Calling .withLoginTimeout(n) on SnowflakeIO / DataSourceConfiguration with a value the Snowflake JDBC driver refuses (e.g. negative or unparsable value driving driver-side validation), producing a SQLException inside setLoginTimeout.

Common situations: Passing a negative timeout from a misconfigured pipeline option; type coercion issues where the option string was parsed incorrectly; an unusual driver version that validates differently.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/67254bffd92b7b08. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/SnowflakeIO.java:1880

          dataSource.setSchema(getSchema().get());
        }
        if (isNotEmpty(getServerName())) {
          dataSource.setServerName(getServerName().get());
        }
        if (getPortNumber() != null) {
          dataSource.setPortNumber(getPortNumber());
        }
        if (isNotEmpty(getRole())) {
          dataSource.setRole(getRole().get());
        }
        if (getAuthenticator() != null) {
          dataSource.setAuthenticator(getAuthenticator());
        }
        if (getLoginTimeout() != null) {
          try {
            dataSource.setLoginTimeout(getLoginTimeout());
          } catch (SQLException e) {
            throw new RuntimeException("Failed to setLoginTimeout");
          }
        }
        return dataSource;
      }
      return getDataSource();
    }

    private String buildUrl() {
      StringBuilder url = new StringBuilder();

      if (getUrl() != null) {
        url.append(getUrl());
      } else {
        url.append("jdbc:snowflake://");
        url.append(getServerName().get());
      }
      if (getPortNumber() != null) {
        url.append(":").append(getPortNumber());

View on GitHub (pinned to 12126d8942)