{"record":{"id":"5ba5add87d77fc91","repo":"pentaho/pentaho-kettle","slug":"closuregenerator-exception-childfieldnotfound","errorCode":null,"errorMessage":"ClosureGenerator.Exception.ChildFieldNotFound","messagePattern":"ClosureGenerator\\.Exception\\.ChildFieldNotFound","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/closure/ClosureGenerator.java","lineNumber":72,"sourceCode":"        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      }\n    } else {\n      // Writing the rows back...\n      //\n      for ( Object current : data.map.keySet() ) {\n        data.parents = new HashMap<Object, Long>();","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/closure/ClosureGenerator.java#L54-L90","documentation":"ClosureGenerator.processRow looks up the configured child-id field in the input row metadata via indexOfValue(meta.getChildIdFieldName()). If absent (index < 0), it throws a KettleException with this message. Same root cause as the parent-field variant but for the Child ID field setting.","triggerScenarios":"Running the Closure Generator step when the 'Child ID field' configured in the step metadata is not present in the incoming rows.","commonSituations":"Misspelled child field name, upstream field renamed/deleted, mixing up parent and child field entries in the dialog.","solutions":["Verify the Child ID field name in the dialog against the actual input fields","Use 'Get Fields' to select from the real stream","Fix upstream steps that renamed or removed the child field","Preview input rows to confirm field presence"],"exampleFix":"// before\nChild ID field: child_id\n// after (stream field is childId)\nChild ID field: childId","handlingStrategy":"validation","validationCode":"if (inputRowMeta.indexOfValue(childFieldName) < 0) {\n  throw new IllegalArgumentException(\"Child field \" + childFieldName + \" 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(\"ChildFieldNotFound\")) {\n    // correct Child ID field in dialog\n  }\n}","preventionTips":["Verify both parent and child fields in dialog before save","Preview the input stream","Keep upstream field names stable"],"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"}