pentaho/pentaho-kettle · error · KettleException
LDAPConnection.Error.Add
LDAPConnection.Error.Add
Error message
LDAPConnection.Error.Add
What it means
LDAPConnection.add(dn, attributes, values, multValuedSeparator, checkEntry) wraps any non-NameNotFound exception from modifyAttributes(ADD_ATTRIBUTE) in a KettleException with message key 'LDAPConnection.Error.Add' (dn interpolated). Common underlying causes are schema violations (adding a value to a single-valued attribute that already has one), missing attribute definitions, permission denial, or connection failures.
Solutions
- Read e.getCause() to identify schema vs permission vs syntax problems.
- Use update() (REPLACE semantics) instead of add() when the attribute may already hold a value.
- Ensure required objectClasses/auxiliary classes are present for the attributes being added.
- Grant write ACI to the bind account and validate value syntax against the schema.
Example fix
// before
connection.add(dn, new String[]{"mail"}, new String[]{mail}, ";", true); // fails if mail already set
// after
connection.update(dn, new String[]{"mail"}, new String[]{mail}, true); // replace semantics Defensive patterns
Strategy: try-catch
Validate before calling
// Confirm attribute is multi-valued before using ADD_ATTRIBUTE
Attributes schema = ctx.getSchema(dn);
Attribute attrDef = schema.get("AttributeTypes"); // inspect syntax & SINGLE-VALUE flag before add() Try / catch
try {
connection.add(dn, attrs, vals, ";", true);
} catch (KettleException e) {
Throwable root = ExceptionUtils.getRootCause(e);
if (root instanceof SchemaViolationException || root instanceof AttributeInUseException) {
// single-valued attr already set, or attr not allowed: fall back to replace
connection.update(dn, attrs, vals, true);
} else { throw e; }
} Prevention
- Use update()/REPLACE semantics for attributes that may already have values
- Check the multValuedSeparator matches how source data packs multiple values
- Ensure required auxiliary objectClasses are present for optional attributes
- Review server schema (AD vs OpenLDAP differ) before writing attributes
When it happens
Trigger: Adding a second value to a single-valued attribute via ADD_ATTRIBUTE; adding an attribute not permitted by the entry's objectClass; bind user lacks write permission; attribute syntax violation (e.g. non-numeric string in a numeric field).
Common situations: AD rejecting modifications to system attributes; OpenLDAP schema missing an aux objectClass needed for the attribute; multivalued source data with wrong multValuedSeparator causing malformed values.
Related errors
- AnalyticQueryMeta.Exception.SubjectFieldNotFound
- Field [ ] couldn't be found in the input stream!
- GPLoadDataOutput.Exception.FieldNotFound
- LDAPConnection.Error.Delete
- LDAPConnection.Error.Deleting.NameNotFound
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/479282c9c08fe7e8.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LDAPConnection.java:343
throw new KettleException( BaseMessages.getString( PKG, "LDAPConnection.Error.Update", dn ), e );
}
}
public int add( String dn, String[] attributes, String[] values, String multValuedSeparator, boolean checkEntry ) throws KettleException {
try {
Attributes attrs = buildAttributes( dn, attributes, values, multValuedSeparator );
// We had all attributes
getInitialContext().modifyAttributes( dn, DirContext.ADD_ATTRIBUTE, attrs );
return STATUS_ADDED;
} catch ( NameNotFoundException n ) {
// The entry is not found
if ( checkEntry ) {
throw new KettleException(
BaseMessages.getString( PKG, "LDAPConnection.Error.Deleting.NameNotFound", dn ), n );
}
return STATUS_SKIPPED;
} catch ( Exception e ) {
throw new KettleException( BaseMessages.getString( PKG, "LDAPConnection.Error.Add", dn ), e );
}
}
/**
* Insert record in LDAP based on DN
*
* @param dn
* : Distinguished Name (Key for lookup)
* @param attributes
* : contains all the attributes to set for insert
* @param values
* : contains all the values for attributes
* @param multValuedSeparator
* : multi-valued attributes separator
* @throws KettleException
*/
public void insert( String dn, String[] attributes, String[] values, String multValuedSeparator ) throws KettleException {
try {View on GitHub (pinned to f3058517a1)