pentaho/pentaho-kettle · error · KettleException

YamlInput.Exception.CouldnotFindField

Error message

YamlInput.Exception.CouldnotFindField

What it means

readNextString throws this KettleException when the configured YAML field name cannot be found in the incoming row's metadata: getInputRowMeta().indexOfValue(meta.getYamlField()) returns -1. The step logs which field it could not find and fails the transformation.

Solutions

  1. Compare the configured 'Yaml field name' with the actual incoming row fields (use a 'Fields' preview or Get Fields button) and correct the name.
  2. Fix case/space mismatches — matching is exact.
  3. Ensure the upstream step that produces the YAML column runs before and feeds this step.
  4. If upstream metadata is dynamic, add a Select Values step to normalize the field name before YAML Input.

Example fix

// before: meta.setYamlField("Yaml Content"); // upstream emits 'yaml_content'
// after: match exactly
meta.setYamlField("yaml_content");
Defensive patterns

Strategy: validation

Validate before calling

// verify the field exists in the incoming row before the step runs
RowMetaInterface rmi = transMeta.getPrevStepFields(stepMeta);
if (rmi.indexOfValue(yamlFieldName) < 0) {
  throw new IllegalArgumentException("Field not in stream: " + yamlFieldName);
}

Try / catch

try { getOneRow(); } catch (KettleException e) {
  if (e.getMessage().contains("CouldnotFindField")) { logActualStreamFields(getInputRowMeta()); }
}

Prevention

When it happens

Trigger: readNextString on first row after the field name passes the emptiness check: indexOfValue returns < 0 because the upstream stream has no column matching meta.getYamlField() (exact, case-sensitive name match).

Common situations: Upstream step renamed or removed the column, case mismatch between configured name and actual field name, extra spaces in the configured field name, transformation run out of order so the expected field never appears.

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


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/50996f6b728a0326. Report an issue: GitHub.

Appendix: source

Thrown at plugins/yaml-input/impl/src/main/java/org/pentaho/di/trans/steps/yamlinput/YamlInput.java:112

        data.outputRowMeta = getInputRowMeta().clone();
        // Get total previous fields
        data.totalPreviousFields = data.outputRowMeta.size();
        data.totalOutFields = data.totalPreviousFields + data.nrInputFields;
        meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,
          metaStore );

        // Check is Yaml field is provided
        if ( Utils.isEmpty( meta.getYamlField() ) ) {
          logError( BaseMessages.getString( PKG, "YamlInput.Log.NoField" ) );
          throw new KettleException( BaseMessages.getString( PKG, "YamlInput.Log.NoField" ) );
        }

        // cache the position of the field
        data.indexOfYamlField = getInputRowMeta().indexOfValue( meta.getYamlField() );
        if ( data.indexOfYamlField < 0 ) {
          // The field is unreachable !
          logError( BaseMessages.getString( PKG, "YamlInput.Log.ErrorFindingField", meta.getYamlField() ) );
          throw new KettleException( BaseMessages.getString( PKG, "YamlInput.Exception.CouldnotFindField", meta
            .getYamlField() ) );
        }
      }

      // get field value
      String Fieldvalue = getInputRowMeta().getString( data.readrow, data.indexOfYamlField );

      getLinesInput();

      if ( log.isDetailed() ) {
        logDetailed( BaseMessages.getString( PKG, "YamlInput.Log.YAMLStream", meta.getYamlField(), Fieldvalue ) );
      }

      if ( meta.getIsAFile() ) {

        // source is a file.

        data.yaml = new YamlReader( getTransMeta().getBowl() );

View on GitHub (pinned to f3058517a1)