{"record":{"id":"d9ece108446c159c","repo":"pentaho/pentaho-kettle","slug":"ssh-error-commandfieldmissing","errorCode":"SSH.Error.CommandFieldMissing","errorMessage":"SSH.Error.CommandFieldMissing","messagePattern":"SSH\\.Error\\.CommandFieldMissing","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/ssh/SSH.java","lineNumber":72,"sourceCode":"    Object[] row;\n    if ( meta.isDynamicCommand() ) {\n      row = getRow();\n      if ( row == null ) {\n        setOutputDone();\n        return false;\n      }\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();","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/ssh/SSH.java#L54-L90","documentation":"SSH step's processRow(), when meta.isDynamicCommand() is true, requires the name of the input field holding the command to execute. If that configured field name is empty it throws KettleException 'SSH.Error.CommandFieldMissing' before processing rows. In dynamic-command mode the step cannot know what to send over SSH without this field reference.","triggerScenarios":"Enabling the 'execute commands from field' / dynamic-command option in the SSH step but leaving the 'command field name' setting blank; loading metadata where the commandfieldname attribute was saved empty.","commonSituations":"Toggling the dynamic option during testing and forgetting to pick the field; renaming a transformation copy where the field name was cleared; building the step programmatically and not calling setcommandfieldname().","solutions":["Open the SSH step dialog and select the input field that contains the command in the 'command field name' setting","Ensure the upstream step actually produces that field and that its name matches exactly (case-sensitive)","If commands are static instead, disable the dynamic-command option and type the command directly"],"exampleFix":"// before\nmeta.setDynamicCommand( true );\nmeta.setcommandfieldname( \"\" );\n// after\nmeta.setDynamicCommand( true );\nmeta.setcommandfieldname( \"cmd\" ); // upstream Text File Input field named 'cmd'","handlingStrategy":"validation","validationCode":"if ( meta.isDynamicCommand() &&\n     ( meta.getcommandfieldname() == null || meta.getcommandfieldname().isEmpty() ) ) {\n  throw new IllegalStateException( \"SSH step: dynamic command enabled but command field name is empty\" );\n}","typeGuard":null,"tryCatchPattern":"try {\n  sshStep.processRow();\n} catch ( KettleException e ) {\n  if ( e.getMessage().contains( \"CommandFieldMissing\" ) ) {\n    // set the command field in step metadata, then reinitialize\n  }\n}","preventionTips":["Whenever enabling dynamic command mode, immediately pick the command field","Validate step settings via the dialog's Verify/OK before saving","Document that static commands should use the non-dynamic option"],"tags":["kettle","pentaho","ssh","configuration","step-runtime"],"backgroundTag":"empty-required-field","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"}