pentaho/pentaho-kettle · error · KettleException
CloneRow.Exception.CouldnotFindField
Error message
CloneRow.Exception.CouldnotFindField
What it means
When the clone count comes from an input field, CloneRow looks up that field's index in the incoming row meta. If the configured field does not exist in the stream, it logs 'Error finding field' and throws this KettleException with the field name.
Solutions
- Add/fix the field in the upstream stream (e.g. via a 'Get variables' or 'User Defined Java Expression' step) before CloneRow
- Correct the 'nr clones in field' name in the CloneRow dialog to match the actual stream field
- Use Specified order / Select values to ensure the field is present and named consistently
- Inspect the incoming row layout (preview) to confirm the field exists
Example fix
// before cloneRowMeta.setNrCloneField( "cln_cnt" ); // stream has "clone_count" // after cloneRowMeta.setNrCloneField( "clone_count" );
Defensive patterns
Strategy: validation
Validate before calling
String f = meta.getNrCloneField();
if (!inputRowMeta.indexOfValue(f).isEmptyOrMinusOne) { /* pseudo */ }
// actual:
if (inputRowMeta.indexOfValue(f) < 0) {
throw new IllegalArgumentException("Field not in stream: " + f);
} Try / catch
catch (KettleException e) { if (e.getMessage().contains("CouldnotFindField")) { log which upstream step dropped the field; } } Prevention
- Preview upstream rows to confirm field names before configuring CloneRow
- Avoid renaming fields upstream without updating downstream steps
- Use Select values to pin field names/order
When it happens
Trigger: processRow with isNrCloneInField()==true where getInputRowMeta().indexOfValue(cloneinfieldname) returns -1 — the field is absent from the upstream stream.
Common situations: Renaming or removing the source field upstream (Select values / change of preceding step); typo in the field name; a variable-hop (Get variables) step reordering the stream; field only present conditionally.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- CloneRow.Error.CloneFlagFieldMissing
- CloneRow.Error.CloneNumFieldMissing
- CloneRow.Error.NrCloneInFieldMissing
- CloneRow.Log.NrClonesIsNull
- Rest.Exception.ErrorFindingField
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/28cd7b1d2d4eb872.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/clonerow/CloneRow.java:95
logError( BaseMessages.getString( PKG, "CloneRow.Error.CloneNumFieldMissing" ) );
throw new KettleException( BaseMessages.getString( PKG, "CloneRow.Error.CloneNumFieldMissing" ) );
}
}
if ( meta.isNrCloneInField() ) {
String cloneinfieldname = meta.getNrCloneField();
if ( Utils.isEmpty( cloneinfieldname ) ) {
logError( BaseMessages.getString( PKG, "CloneRow.Error.NrCloneInFieldMissing" ) );
throw new KettleException( BaseMessages.getString( PKG, "CloneRow.Error.NrCloneInFieldMissing" ) );
}
// cache the position of the field
if ( data.indexOfNrCloneField < 0 ) {
data.indexOfNrCloneField = getInputRowMeta().indexOfValue( cloneinfieldname );
if ( data.indexOfNrCloneField < 0 ) {
// The field is unreachable !
logError( BaseMessages.getString( PKG, "CloneRow.Log.ErrorFindingField" )
+ "[" + cloneinfieldname + "]" );
throw new KettleException( BaseMessages.getString(
PKG, "CloneRow.Exception.CouldnotFindField", cloneinfieldname ) );
}
}
} else {
String nrclonesString = environmentSubstitute( meta.getNrClones() );
data.nrclones = Const.toInt( nrclonesString, 0 );
if ( log.isDebug() ) {
logDebug( BaseMessages.getString( PKG, "CloneRow.Log.NrClones", "" + data.nrclones ) );
}
}
}
Object[] outputRowData = r;
if ( data.addInfosToRow ) {
// It's the original row..
// We need here to add some infos in order to identify this row
outputRowData = RowDataUtil.createResizedCopy( r, data.outputRowMeta.size() );View on GitHub (pinned to f3058517a1)