{"record":{"id":"1f029480cbb9e6aa","repo":"pentaho/pentaho-kettle","slug":"jsoninput-exception-couldnotfindfield","errorCode":"JsonInput.Exception.CouldnotFindField","errorMessage":"JsonInput.Exception.CouldnotFindField","messagePattern":"JsonInput\\.Exception\\.CouldnotFindField","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/JsonInput.java","lineNumber":175,"sourceCode":"      if ( data.inputRowMeta == null ) {\n        data.hasFirstRow = false;\n        return;\n      }\n      data.hasFirstRow = true;\n      data.outputRowMeta = data.inputRowMeta.clone();\n\n      // Check if source field is provided\n      if ( Utils.isEmpty( meta.getFieldValue() ) ) {\n        logError( BaseMessages.getString( PKG, \"JsonInput.Log.NoField\" ) );\n        throw new KettleException( BaseMessages.getString( PKG, \"JsonInput.Log.NoField\" ) );\n      }\n\n      // cache the position of the field\n      if ( data.indexSourceField < 0 ) {\n        data.indexSourceField = getInputRowMeta().indexOfValue( meta.getFieldValue() );\n        if ( data.indexSourceField < 0 ) {\n          logError( BaseMessages.getString( PKG, \"JsonInput.Log.ErrorFindingField\", meta.getFieldValue() ) );\n          throw new KettleException( BaseMessages.getString( PKG, \"JsonInput.Exception.CouldnotFindField\",\n            meta.getFieldValue() ) );\n        }\n      }\n\n      // if RemoveSourceField option is set, we remove the source field from the output meta\n      if ( meta.isRemoveSourceField() ) {\n        data.outputRowMeta.removeValueMeta( data.indexSourceField );\n        // Get total previous fields minus one since we remove source field\n        data.totalpreviousfields = data.inputRowMeta.size() - 1;\n      } else {\n        // Get total previous fields\n        data.totalpreviousfields = data.inputRowMeta.size();\n      }\n    }\n    meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,\n                    metaStore );\n\n    // Create convert meta-data objects that will contain Date & Number formatters","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/JsonInput.java#L157-L193","documentation":"JsonInput throws KettleException with key JsonInput.Exception.CouldnotFindField when the configured source field (meta.getFieldValue()) cannot be found in the incoming row metadata (indexOfValue returns -1). It logs JsonInput.Log.ErrorFindingField with the field name first.","triggerScenarios":"prepareToRowProcessing, called from the first processRow, looks up the configured field name in getInputRowMeta() and does not find it.","commonSituations":"Upstream step renamed or removed the field; case-sensitivity mismatch in the field name; transformation restructured so the JSON Input step no longer receives the field.","solutions":["Verify the exact field name in 'Field value' matches the upstream output (watch case).","Preview the previous step's output to confirm the field exists and copy its exact name.","Re-run 'Get Fields' in the JSON Input step to refresh available fields.","If an upstream rename was intentional, update the field reference in this step."],"exampleFix":"// before: field name that no longer exists upstream\nmeta.setFieldValue( \"JsonColumn\" );\n// after: exact name as produced by the previous step\nmeta.setFieldValue( \"jsonColumn\" );","handlingStrategy":"validation","validationCode":"RowMetaInterface prev = transMeta.getPrevStepFields(jsonInputStep);\nif (prev.indexOfValue(meta.getFieldValue()) < 0) {\n  throw new IllegalArgumentException(\"Field '\" + meta.getFieldValue() + \"' not present in input rows\");\n}","typeGuard":null,"tryCatchPattern":"try { trans.execute(...); } catch (KettleException e) { if (e.getMessage().contains(\"CouldnotFindField\")) { /* fix the field reference or upstream rename */ } }","preventionTips":["Match field names exactly, including case, when configuring the step.","Preview upstream rows before finalizing the field setting.","Refresh mappings with 'Get Fields' after upstream changes."],"tags":["json","field-mapping","metadata"],"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"}