{"record":{"id":"00e460f661208702","repo":"pentaho/pentaho-kettle","slug":"undefined-connection-provider-for-key-s","errorCode":null,"errorMessage":"Undefined connection provider for key '%s'.","messagePattern":"Undefined connection provider for key '(.+?)'\\.","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/connections/vfs/VFSConnectionManagerHelper.java","lineNumber":143,"sourceCode":"   * A provider key is either its own {@link ConnectionProvider#getKey()} or a registered alias, via\n   * {@link ConnectionManager#addLookupFilter(LookupFilter)}.\n   * <p>\n   * This method will throw a {@link ClassCastException} exception if a provider with the given key is defined which is\n   * not of the expected type, {@link VFSConnectionProvider<T>}.\n   *\n   * @param key The provider key.\n   * @return The VFS connection provider.\n   * @throws KettleException When a provider with the given key is not defined.\n   */\n  @NonNull\n  public <T extends VFSConnectionDetails> VFSConnectionProvider<T> getExistingProvider(\n    @NonNull ConnectionManager manager,\n    @Nullable String key )\n    throws KettleException {\n\n    VFSConnectionProvider<T> provider = getProvider( manager, key );\n    if ( provider == null ) {\n      throw new KettleException( String.format( \"Undefined connection provider for key '%s'.\", key ) );\n    }\n\n    return provider;\n  }\n\n  /**\n   * Gets a VFS provider, given the details of the VFS connection.\n   * <p>\n   * This method will throw a {@link ClassCastException} exception if a provider with the given key is defined which is\n   * not of the expected type, {@link VFSConnectionProvider<T>}.\n   *\n   * @param details The details of the VFS connection.\n   * @return The VFS connection provider, if one exists; {@code null}, otherwise.\n   */\n  @Nullable\n  public <T extends VFSConnectionDetails> VFSConnectionProvider<T> getProvider(\n    @NonNull ConnectionManager manager,\n    @Nullable T details ) {","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/connections/vfs/VFSConnectionManagerHelper.java#L125-L161","documentation":"VFSConnectionManagerHelper.getExistingProvider looks up a VFSConnectionProvider in the ConnectionManager by key. If no provider is registered under that key, it throws a KettleException stating the provider is undefined. The key identifies a named VFS connection registration; without a provider, no file operations can be performed.","triggerScenarios":"Calling getExistingProvider (or provider(...)) with a key for which no VFS connection was ever registered, a misspelled connection name, or a key whose connection was removed from the ConnectionManager before the lookup.","commonSituations":"Typo in connection name passed to the helper; environment migration where connection definitions were not imported; a connection deleted by another part of the pipeline; case-sensitivity differences in the key.","solutions":["Register the VFS connection under this key before use (add the connection to the ConnectionManager / repository).","Print available connection keys and verify exact spelling/case of the key.","Guard with getProvider(...) first and handle the null case instead of using getExistingProvider.","Ensure the connection definition file/metadata was actually loaded in this environment."],"exampleFix":"// before\nVFSConnectionProvider<Details> p = helper.getExistingProvider( manager, \"myConn\" );\n// after\nVFSConnectionProvider<Details> p = helper.getProvider( manager, \"myConn\" );\nif ( p == null ) {\n  manager.addConnection( \"myConn\", details ); // or fail fast with a clear message\n  p = helper.getExistingProvider( manager, \"myConn\" );\n}","handlingStrategy":"try-catch","validationCode":"if ( helper.getProvider( manager, key ) == null ) {\n  throw new IllegalStateException( \"Connection '\" + key + \"' is not registered; register it first\" );\n}","typeGuard":"null","tryCatchPattern":"try {\n  VFSConnectionProvider<Details> p = helper.getExistingProvider( manager, key );\n} catch ( KettleException e ) {\n  // log key, list registered connections, rethrow with actionable message\n}","preventionTips":["Register connections before any file resolution at pipeline start","Centralize connection key constants to avoid typos","Log available keys on startup to ease diagnosis"],"tags":["vfs","lookup","connection-manager"],"backgroundTag":"record-not-found","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"}