{"record":{"id":"6f8b41d3fad86a73","repo":"pentaho/pentaho-kettle","slug":"ssh-exception-couldnotfindfield","errorCode":"SSH.Exception.CouldnotFindField","errorMessage":"SSH.Exception.CouldnotFindField","messagePattern":"SSH\\.Exception\\.CouldnotFindField","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/ssh/SSH.java","lineNumber":78,"sourceCode":"      }\n      if ( first ) {\n        first = false;\n        data.outputRowMeta = getInputRowMeta().clone();\n        data.nrInputFields = data.outputRowMeta.size();\n        meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,\n          metaStore );\n        data.nrOutputFields = data.outputRowMeta.size();\n\n        // Check if commands field is provided\n        if ( meta.isDynamicCommand() ) {\n          if ( Utils.isEmpty( meta.getcommandfieldname() ) ) {\n            throw new KettleException( BaseMessages.getString( PKG, \"SSH.Error.CommandFieldMissing\" ) );\n          }\n          // cache the position of the source filename field\n          data.indexOfCommand = data.outputRowMeta.indexOfValue( meta.getcommandfieldname() );\n          if ( data.indexOfCommand < 0 ) {\n            // The field is unreachable !\n            throw new KettleException( BaseMessages.getString( PKG, \"SSH.Exception.CouldnotFindField\", meta\n              .getcommandfieldname() ) );\n          }\n        }\n      }\n    } else {\n      if ( !data.wroteOneRow ) {\n        row = new Object[] {}; // empty row\n        incrementLinesRead();\n        data.wroteOneRow = true;\n        if ( first ) {\n          first = false;\n          data.outputRowMeta = new RowMeta();\n          data.nrInputFields = 0;\n          meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,\n            metaStore );\n          data.nrOutputFields = data.outputRowMeta.size();\n          data.commands = environmentSubstitute( meta.getCommand() );\n        }","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/ssh/SSH.java#L60-L96","documentation":"SSH step's processRow(), in dynamic-command mode, caches data.indexOfCommand = outputRowMeta.indexOfValue(commandFieldName); if the field is not present in the row stream (index < 0) it throws KettleException 'SSH.Exception.CouldnotFindField' with the field name as parameter. The step cannot execute commands because the configured command field does not exist in incoming rows.","triggerScenarios":"The 'command field name' setting names a field that no upstream step produces: typo, upstream step removed/renamed, field renamed after configuring the SSH step, or field added on a branch that doesn't feed this step.","commonSituations":"Renaming an upstream 'Add constants' or text-input field and forgetting to update the SSH step; connecting the SSH step to the wrong hop; case mismatch between configured name and actual field (Kettle field lookup is case-sensitive).","solutions":["Check upstream steps' output fields (right-click -> Show output fields) and set the SSH step's command field to an existing name","Fix case sensitivity: field names must match exactly (e.g. 'CMD' vs 'cmd')","Reconnect the correct hop so the row stream actually contains the command field","Re-run Get Fields / reopen the dialog after upstream changes to refresh the selection"],"exampleFix":"// before (upstream field renamed)\nmeta.setcommandfieldname( \"command\" ); // upstream produces 'cmd'\n// after\nmeta.setcommandfieldname( \"cmd\" ); // matches upstream output field","handlingStrategy":"type-guard","validationCode":"// Before running, confirm the field exists in the previous step's output:\nRowMetaInterface prev = transMeta.getPrevStepFields( sshStepMeta );\nString cmdField = meta.getcommandfieldname();\nif ( cmdField == null || prev.indexOfValue( cmdField ) < 0 ) {\n  throw new IllegalStateException( \"SSH step: field '\" + cmdField + \"' not found in upstream rows\" );\n}","typeGuard":"boolean commandFieldExists( RowMetaInterface rowMeta, String fieldName ) {\n  return fieldName != null && rowMeta != null && rowMeta.indexOfValue( fieldName ) >= 0;\n}","tryCatchPattern":"try {\n  sshStep.processRow();\n} catch ( KettleException e ) {\n  if ( e.getMessage().contains( \"CouldnotFindField\" ) ) {\n    // inspect upstream output fields and fix the configured field name\n  }\n}","preventionTips":["Use 'Show output fields' on the hop feeding the SSH step when configuring it","Field names are case-sensitive: match exactly","Re-check SSH step config after renaming upstream fields","Keep command-field-producing steps on the same branch as the SSH step"],"tags":["kettle","pentaho","ssh","row-stream","field-not-found"],"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"}