{"record":{"id":"88018f5bebb1333e","repo":"pentaho/pentaho-kettle","slug":"closuregenerator-exception-parentfieldnotfound","errorCode":null,"errorMessage":"ClosureGenerator.Exception.ParentFieldNotFound","messagePattern":"ClosureGenerator\\.Exception\\.ParentFieldNotFound","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/closure/ClosureGenerator.java","lineNumber":67,"sourceCode":"      Object[] rowData = getRow();\n\n      if ( rowData == null ) {\n        data.reading = false;\n      } else {\n        if ( first ) {\n          first = false;\n\n          // Create the output row metadata\n          //\n          data.outputRowMeta = getInputRowMeta().clone();\n          meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,\n            metaStore );\n\n          // Get indexes of parent and child field\n          //\n          data.parentIndex = getInputRowMeta().indexOfValue( meta.getParentIdFieldName() );\n          if ( data.parentIndex < 0 ) {\n            throw new KettleException( BaseMessages.getString(\n              PKG, \"ClosureGenerator.Exception.ParentFieldNotFound\" ) );\n          }\n          data.childIndex = getInputRowMeta().indexOfValue( meta.getChildIdFieldName() );\n          if ( data.childIndex < 0 ) {\n            throw new KettleException( BaseMessages.getString(\n              PKG, \"ClosureGenerator.Exception.ChildFieldNotFound\" ) );\n          }\n\n          data.parentValueMeta = getInputRowMeta().getValueMeta( data.parentIndex );\n          data.childValueMeta = getInputRowMeta().getValueMeta( data.childIndex );\n        }\n\n        // add values to the buffer...\n        //\n        Object parentId = rowData[ data.parentIndex ];\n        Object childId = rowData[ data.childIndex ];\n        data.map.put( childId, parentId );\n      }","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/closure/ClosureGenerator.java#L49-L85","documentation":"ClosureGenerator.processRow looks up the configured parent-id field in the incoming row metadata via indexOfValue(meta.getParentIdFieldName()). If the field is absent from the input stream (index < 0), it throws a KettleException with this message. It means the Parent ID field configured on the step does not exist in the rows entering the step.","triggerScenarios":"Running the Closure Generator step when the field named in 'Parent ID field' is not present in the input row layout — renamed upstream field, wrong field name configured, or wrong hop ordering.","commonSituations":"Renaming or removing the parent field in an earlier step, misspelling the field name in the dialog, connecting a different stream than intended.","solutions":["Open the Closure Generator dialog and verify the Parent ID field name matches the incoming stream exactly","Use 'Get Fields' in the dialog to pick from actual upstream fields","Check upstream steps for renames/deletions of the field","Preview the input rows to confirm the field exists"],"exampleFix":"// before: dialog has parent_field\nParent ID field: parent_field\n// after (stream field is parentId)\nParent ID field: parentId","handlingStrategy":"validation","validationCode":"// In a prior step or dialog check:\nif (inputRowMeta.indexOfValue(parentFieldName) < 0) {\n  throw new IllegalArgumentException(\"Parent field \" + parentFieldName + \" missing from stream\");\n}","typeGuard":"boolean hasField(RowMetaInterface rowMeta, String name) {\n  return name != null && rowMeta.indexOfValue(name) >= 0;\n}","tryCatchPattern":"try {\n  step.processRow();\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"ParentFieldNotFound\")) {\n    // fix field mapping in dialog and restart transformation\n  }\n}","preventionTips":["Always use 'Get Fields' in the step dialog","Preview upstream rows before running","Avoid renaming fields mid-pipeline without updating dependent steps"],"tags":["field-mapping","stream","pdi"],"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"}