{"record":{"id":"21c7b7d9e694ff78","repo":"pentaho/pentaho-kettle","slug":"ldapinput-exception-cannotreadldap","errorCode":"LDAPInput.Exception.CanNotReadLDAP","errorMessage":"LDAPInput.Exception.CanNotReadLDAP","messagePattern":"LDAPInput\\.Exception\\.CanNotReadLDAP","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LDAPInput.java","lineNumber":270,"sourceCode":"      } // End of loop over fields...\n\n      int fIndex = data.nrIncomingFields + data.nrfields;\n\n      // See if we need to add the row number to the row...\n      if ( meta.includeRowNumber() && !Utils.isEmpty( meta.getRowNumberField() ) ) {\n        outputRowData[fIndex] = new Long( data.rownr );\n      }\n\n      RowMetaInterface irow = getInputRowMeta();\n\n      data.previousRow = irow == null ? outputRowData : irow.cloneRow( outputRowData ); // copy it to make\n      // surely the next step doesn't change it in between...\n      data.rownr++;\n\n      incrementLinesInput();\n\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"LDAPInput.Exception.CanNotReadLDAP\" ), e );\n    }\n    return outputRowData;\n  }\n\n  private Object getAttributeValue( LDAPInputField field, Attribute attr, int i, Object outputRowData ) throws Exception {\n\n    if ( field.getType() == ValueMetaInterface.TYPE_BINARY ) {\n      // It's a binary field\n      // no need to convert, just return the value as it\n      try {\n        return attr.get();\n      } catch ( java.lang.ClassCastException e ) {\n        return attr.get().toString().getBytes();\n      }\n    }\n\n    String retval = null;\n    if ( field.getReturnType() == LDAPInputField.FETCH_ATTRIBUTE_AS_BINARY","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LDAPInput.java#L252-L288","documentation":"buildRow() wraps any exception during reading an LDAP entry and building the output row in this KettleException, with the original exception chained as cause. It covers search execution (non-dynamic path), attribute extraction, and value conversion for each row. It is the generic per-row read failure for the LDAP Input step.","triggerScenarios":"Any Exception in buildRow's try block: conn.getAttributes() failing, getAttributeValue() throwing (e.g. attribute missing, binary conversion error), or the initial LDAP connection/search throwing when reading rows.","commonSituations":"Requested attribute not present on entries (getAttribute returns null and conversion NPEs), binary attributes (photos, certificates) not marked as binary in field config, directory timeout on large subtree searches, wrong time/size limit settings.","solutions":["Inspect the chained cause (e.getCause()) for the precise naming/conversion error.","Verify every configured return field exists on the LDAP entries; adjust the filter so matched entries carry them.","Mark binary attributes (e.g. objectGUID, jpegPhoto) as 'binary' in the step's Fields tab.","Increase the directory-side size/time limits or narrow the search base/filter to reduce result size."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-flight: ensure configured return fields exist on a sample entry\nAttributes sample = ctx.getAttributes(sampleDn);\nfor (String f : returnFields) { if (sample.get(f) == null) logBasic(\"Field \" + f + \" absent on sample entry\"); }","typeGuard":null,"tryCatchPattern":"try { rowData = buildRow(meta, data); } catch (KettleException e) { logError(\"LDAP row read failed: \" + e.getCause(), e); setErrors(1); stopAll(); }","preventionTips":["Mark binary attributes as binary in the Fields tab","Test the filter on a small base before subtree-wide searches","Set directory size/time limits appropriate to expected result counts","Log e.getCause() — the real LDAP error is chained"],"tags":["ldap","row-processing","data-conversion"],"backgroundTag":"ldap-search-failed","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"}