{"record":{"id":"a85ffda2da0c0fd3","repo":"apache/dolphinscheduler","slug":"unsupported-authentication-mode-redshiftconne","errorCode":null,"errorMessage":"Unsupported authentication mode: \" + redshiftConnectionParam.getMode()","messagePattern":"Unsupported authentication mode: \" \\+ redshiftConnectionParam\\.getMode\\(\\)","errorType":"exception","errorClass":"SQLException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-redshift/src/main/java/org/apache/dolphinscheduler/plugin/datasource/redshift/param/RedshiftDataSourceProcessor.java","lineNumber":145,"sourceCode":"        }\n        return redshiftConnectionParam.getJdbcUrl();\n    }\n\n    @Override\n    public Connection getConnection(ConnectionParam connectionParam) throws SQLException {\n        RedshiftConnectionParam redshiftConnectionParam = (RedshiftConnectionParam) connectionParam;\n        if (redshiftConnectionParam.getMode().equals(RedshiftAuthMode.PASSWORD)) {\n            return JdbcDriverConnectionProvider.builder()\n                    .jdbcDriverClassName(getDatasourceDriver())\n                    .jdbcUrl(getJdbcUrl(redshiftConnectionParam))\n                    .username(redshiftConnectionParam.getUser())\n                    .password(PasswordUtils.decodePassword(redshiftConnectionParam.getPassword()))\n                    .build()\n                    .getConnection();\n        } else if (redshiftConnectionParam.getMode().equals(RedshiftAuthMode.IAM_ACCESS_KEY)) {\n            return getConnectionByIAM(redshiftConnectionParam);\n        }\n        throw new SQLException(\"Unsupported authentication mode: \" + redshiftConnectionParam.getMode());\n    }\n\n    @Override\n    public DbType getDbType() {\n        return DbType.REDSHIFT;\n    }\n\n    @Override\n    public DataSourceProcessor create() {\n        return new RedshiftDataSourceProcessor();\n    }\n\n    /**\n     * 2 auth mode\n     * PASSWORD: address example: jdbc:redshift://examplecluster.abc123xyz789.us-west-2.redshift.amazonaws.com:5439\n     * IAM_ACCESS_KEY:\n     * address example1: jdbc:redshift:iam://examplecluster:us-west-2\n     * address example2: jdbc:redshift:iam://examplecluster.abc123xyz789.us-west-2.redshift.amazonaws.com:5439","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-redshift/src/main/java/org/apache/dolphinscheduler/plugin/datasource/redshift/param/RedshiftDataSourceProcessor.java#L127-L163","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set the Redshift datasource 'mode' field to 'PASSWORD' or 'IAM_ACCESS_KEY' exactly","If mode is missing in saved config, edit the datasource and choose an auth mode in the UI","When using IAM, also fill the required IAM fields (accessKey, secretKey, etc.) and ensure the Redshift IAM auth jars are on the classpath"],"exampleFix":"// before\n{\"type\":\"REDSHIFT\",\"mode\":\"IAM_ROLE\"}   // unsupported value\n// after\n{\"type\":\"REDSHIFT\",\"mode\":\"IAM_ACCESS_KEY\",\"accessKey\":\"...\",\"secretKey\":\"...\"}","handlingStrategy":"validation","validationCode":"String mode = redshiftParam.getMode();\nif (!\"PASSWORD\".equals(mode) && !\"IAM_ACCESS_KEY\".equals(mode)) {\n  throw new IllegalArgumentException(\"Redshift mode must be PASSWORD or IAM_ACCESS_KEY, got: \" + mode);\n}","typeGuard":"boolean knownAuthMode(String m) {\n  try { RedshiftAuthMode.valueOf(m); return true; } catch (Exception e) { return false; }\n}","tryCatchPattern":"try (Connection c = processor.getConnection(connParam)) {\n  // use connection\n} catch (SQLException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"Unsupported authentication mode\")) {\n    throw new IllegalStateException(\"Fix Redshift datasource auth mode: \" + e.getMessage(), e);\n  }\n  throw e;\n}","preventionTips":["Always set mode explicitly when creating Redshift datasources programmatically","Restrict mode field in UI to the two supported values","After upgrades, re-check saved datasources whose mode field predates new enum values"],"tags":["redshift","jdbc","authentication","invalid-enum-value"],"backgroundTag":"invalid-enum-value","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}