{"record":{"id":"e73315cd36e0d1c5","repo":"pentaho/pentaho-kettle","slug":"unable-to-initialize-the-two-way-password-encoder-no-encoder","errorCode":null,"errorMessage":"Unable to initialize the two way password encoder: No encoder plugin type specified.","messagePattern":"Unable to initialize the two way password encoder: No encoder plugin type specified\\.","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/encryption/Encr.java","lineNumber":48,"sourceCode":" * @author Matt\n * @since 17-12-2003\n *\n */\npublic class Encr {\n\n  private static TwoWayPasswordEncoderInterface encoder;\n\n  public Encr() {\n  }\n\n  @Deprecated\n  public boolean init() {\n    return true;\n  }\n\n  public static void init( String encoderPluginId ) throws KettleException {\n    if ( Utils.isEmpty( encoderPluginId ) ) {\n      throw new KettleException( \"Unable to initialize the two way password encoder: No encoder plugin type specified.\" );\n    }\n    PluginRegistry registry = PluginRegistry.getInstance();\n    PluginInterface plugin = registry.findPluginWithId( TwoWayPasswordEncoderPluginType.class, encoderPluginId );\n    if ( plugin == null ) {\n      throw new KettleException( \"Unable to find plugin with ID '\" + encoderPluginId + \"'.  If this is a test, make sure\"\n        + \" kettle-core tests jar is a dependency.  If this is live make sure a kettle-password-encoder-plugins.xml\"\n        + \" exits in the classpath\" );\n    }\n    encoder = (TwoWayPasswordEncoderInterface) registry.loadClass( plugin );\n\n    // Load encoder specific options...\n    //\n    try {\n      encoder.init();\n    } catch ( PasswordEncoderException e ) {\n      throw new KettleException( e );\n    }\n  }","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/encryption/Encr.java#L30-L66","documentation":"Encr.init(encoderPluginId) initializes the two-way password encoder by loading a plugin from the PluginRegistry; it throws KettleException when the supplied plugin id is null or empty, because without an encoder plugin id no password encode/decode can be performed.","triggerScenarios":"Calling Encr.init(null) or Encr.init(\"\") — e.g. the KETTLE_TWO_WAY_PASSWORD_ENCODER system property / kettle.properties entry is unset and its value is passed straight to init().","commonSituations":"Standalone/embedded usage of Kettle APIs (Encr, DecryptingDataSource) without initializing the Kettle environment, missing kettle.properties, or the encoder plugin id environment variable removed during migration.","solutions":["Set the encoder plugin id, e.g. System.setProperty( Const.KETTLE_TWO_WAY_PASSWORD_ENCODER, \"kettle\" ) (or 'freemarker-style' as configured) before init.","Call KettleEnvironment.init() first, which initializes Encr with the default encoder.","Pass a valid plugin id registered in kettle-password-encoder-plugins.xml.","Guard the call: check Utils.isEmpty(encoderPluginId) and fail with a clear config error."],"exampleFix":"// before\nEncr.init( System.getProperty( Const.KETTLE_TWO_WAY_PASSWORD_ENCODER ) ); // null\n// after\nString id = System.getProperty( Const.KETTLE_TWO_WAY_PASSWORD_ENCODER, \"kettle\" );\nif ( Utils.isEmpty( id ) ) throw new IllegalStateException( \"Encoder plugin id required\" );\nEncr.init( id );","handlingStrategy":"validation","validationCode":"String id = System.getProperty( Const.KETTLE_TWO_WAY_PASSWORD_ENCODER );\nif ( id == null || id.isEmpty() ) {\n  throw new IllegalStateException( \"Set \" + Const.KETTLE_TWO_WAY_PASSWORD_ENCODER + \" before Encr.init\" );\n}","typeGuard":null,"tryCatchPattern":"try {\n  Encr.init( encoderPluginId );\n} catch ( KettleException e ) {\n  throw new IllegalStateException( \"Password encoder plugin id missing; check kettle.properties\", e );\n}","preventionTips":["Call KettleEnvironment.init() before using Encr","Set KETTLE_TWO_WAY_PASSWORD_ENCODER in kettle.properties","Never pass unguarded System.getProperty results into Encr.init"],"tags":["encryption","plugin","initialization"],"backgroundTag":"missing-required-config-field","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}