apache/dolphinscheduler · error · SQLException

Unsupported authentication mode: " + redshiftConnectionParam

Error message

Unsupported authentication mode: " + redshiftConnectionParam.getMode()

What it means

RedshiftDataSourceProcessor.getConnection supports two authentication modes: PASSWORD and IAM_ACCESS_KEY; any other mode value (null or unmapped) reaches the fall-through SQLException. It indicates the datasource's auth mode field doesn't match a supported RedshiftAuthMode.

Source

Thrown at dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-redshift/src/main/java/org/apache/dolphinscheduler/plugin/datasource/redshift/param/RedshiftDataSourceProcessor.java:145

        }
        return redshiftConnectionParam.getJdbcUrl();
    }

    @Override
    public Connection getConnection(ConnectionParam connectionParam) throws SQLException {
        RedshiftConnectionParam redshiftConnectionParam = (RedshiftConnectionParam) connectionParam;
        if (redshiftConnectionParam.getMode().equals(RedshiftAuthMode.PASSWORD)) {
            return JdbcDriverConnectionProvider.builder()
                    .jdbcDriverClassName(getDatasourceDriver())
                    .jdbcUrl(getJdbcUrl(redshiftConnectionParam))
                    .username(redshiftConnectionParam.getUser())
                    .password(PasswordUtils.decodePassword(redshiftConnectionParam.getPassword()))
                    .build()
                    .getConnection();
        } else if (redshiftConnectionParam.getMode().equals(RedshiftAuthMode.IAM_ACCESS_KEY)) {
            return getConnectionByIAM(redshiftConnectionParam);
        }
        throw new SQLException("Unsupported authentication mode: " + redshiftConnectionParam.getMode());
    }

    @Override
    public DbType getDbType() {
        return DbType.REDSHIFT;
    }

    @Override
    public DataSourceProcessor create() {
        return new RedshiftDataSourceProcessor();
    }

    /**
     * 2 auth mode
     * PASSWORD: address example: jdbc:redshift://examplecluster.abc123xyz789.us-west-2.redshift.amazonaws.com:5439
     * IAM_ACCESS_KEY:
     * address example1: jdbc:redshift:iam://examplecluster:us-west-2
     * address example2: jdbc:redshift:iam://examplecluster.abc123xyz789.us-west-2.redshift.amazonaws.com:5439

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Set the Redshift datasource 'mode' field to 'PASSWORD' or 'IAM_ACCESS_KEY' exactly
  2. If mode is missing in saved config, edit the datasource and choose an auth mode in the UI
  3. When using IAM, also fill the required IAM fields (accessKey, secretKey, etc.) and ensure the Redshift IAM auth jars are on the classpath

Example fix

// before
{"type":"REDSHIFT","mode":"IAM_ROLE"}   // unsupported value
// after
{"type":"REDSHIFT","mode":"IAM_ACCESS_KEY","accessKey":"...","secretKey":"..."}
Defensive patterns

Strategy: validation

Validate before calling

String mode = redshiftParam.getMode();
if (!"PASSWORD".equals(mode) && !"IAM_ACCESS_KEY".equals(mode)) {
  throw new IllegalArgumentException("Redshift mode must be PASSWORD or IAM_ACCESS_KEY, got: " + mode);
}

Type guard

boolean knownAuthMode(String m) {
  try { RedshiftAuthMode.valueOf(m); return true; } catch (Exception e) { return false; }
}

Try / catch

try (Connection c = processor.getConnection(connParam)) {
  // use connection
} catch (SQLException e) {
  if (e.getMessage() != null && e.getMessage().startsWith("Unsupported authentication mode")) {
    throw new IllegalStateException("Fix Redshift datasource auth mode: " + e.getMessage(), e);
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling getConnection on a Redshift datasource whose mode is neither RedshiftAuthMode.PASSWORD nor RedshiftAuthMode.IAM_ACCESS_KEY — including mode being null when the param JSON omits it.

Common situations: Datasource JSON with a typo'd mode string ('iam', 'IAM_ROLE'); older saved datasource missing the mode field after upgrade; programmatic creation forgetting to set mode.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/a85ffda2da0c0fd3. Report an issue: GitHub.