{"record":{"id":"aca725c854b6cdd4","repo":"pentaho/pentaho-kettle","slug":"ldapconnection-error-deleting-namenotfound","errorCode":"LDAPConnection.Error.Deleting.NameNotFound","errorMessage":"LDAPConnection.Error.Deleting.NameNotFound","messagePattern":"LDAPConnection\\.Error\\.Deleting\\.NameNotFound","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LDAPConnection.java","lineNumber":290,"sourceCode":"  }\n\n  public int delete( String dn, boolean checkEntry ) throws KettleException {\n    try {\n\n      if ( checkEntry ) {\n        // First Check entry\n        getInitialContext().lookup( dn );\n      }\n      // The entry exists\n      getInitialContext().destroySubcontext( dn );\n      if ( log.isDebug() ) {\n        log.logDebug( BaseMessages.getString( PKG, \"LDAPinput.Exception.Deleted\", dn ) );\n      }\n      return STATUS_DELETED;\n    } catch ( NameNotFoundException n ) {\n      // The entry is not found\n      if ( checkEntry ) {\n        throw new KettleException(\n          BaseMessages.getString( PKG, \"LDAPConnection.Error.Deleting.NameNotFound\", dn ), n );\n      }\n      return STATUS_SKIPPED;\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"LDAPConnection.Error.Delete\", dn ), e );\n    }\n  }\n\n  public int update( String dn, String[] attributes, String[] values, boolean checkEntry ) throws KettleException {\n    try {\n      int nrAttributes = attributes.length;\n      ModificationItem[] mods = new ModificationItem[nrAttributes];\n      for ( int i = 0; i < nrAttributes; i++ ) {\n        // Define attribute\n        Attribute mod = new BasicAttribute( attributes[i], values[i] );\n        if ( log.isDebug() ) {\n          log\n            .logDebug( BaseMessages.getString( PKG, \"LDAPConnection.Update.Attribute\", attributes[i], values[i] ) );","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LDAPConnection.java#L272-L308","documentation":"LDAPConnection.delete(dn, checkEntry) catches NameNotFoundException from the JNDI delete operation. When checkEntry is true it rethrows as a KettleException with message key 'LDAPConnection.Error.Deleting.NameNotFound', meaning the DN targeted for deletion does not exist in the directory. When checkEntry is false the deletion is silently skipped (STATUS_SKIPPED).","triggerScenarios":"Calling delete(dn, true) where dn is not present in the LDAP tree (already deleted, wrong DN spelling, wrong base context, or case/space mismatch in the RDN).","commonSituations":"Running a deletion transformation twice so the second run finds nothing; building the DN from stream fields with stray whitespace or wrong attribute casing (LDAP DN attribute names are case-insensitive but values matter); deleting an entry whose parent OU was renamed.","solutions":["Verify the exact DN with ldapsearch before deleting, or pass checkEntry=false if absence is acceptable (it will be skipped instead of failing).","Trim and normalize the DN string coming from your source data (spaces, case, escaping of '/' and ',').","Confirm the entry has not already been deleted by a previous run.","Check the connection is bound to the expected base DN / naming context."],"exampleFix":"// before\nconnection.delete(dn, true); // fails if DN already gone\n// after\nif (connection.delete(dn, false) == LDAPConnection.STATUS_DELETED) { /* deleted */ } else { logBasic(\"Entry not found, skipped: \" + dn); }","handlingStrategy":"validation","validationCode":"// Check existence before delete\nString filter = \"(entryDN=\" + dn + \")\"; // or search by RDN\nconnection.search(); // returns results; if empty, the DN is absent -> skip or log instead of deleting with checkEntry=true","typeGuard":null,"tryCatchPattern":"try {\n  connection.delete(dn, true);\n} catch (KettleException e) {\n  if (ExceptionUtils.getRootCause(e) instanceof NameNotFoundException) {\n    logBasic(\"DN already absent, treating as deleted: \" + dn); // idempotent handling\n  } else { throw e; }\n}","preventionTips":["Use checkEntry=false when absence is an acceptable outcome","Trim and normalize DN strings from upstream data","Make delete transformations idempotent (safe on rerun)","Verify DNs with ldapsearch in a dry-run pass first"],"tags":["ldap","kettle","delete","name-not-found"],"backgroundTag":"resource-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"}