{"record":{"id":"77f893d48bf11282","repo":"pentaho/pentaho-kettle","slug":"changefileencoding-error-targetfilenamefieldmissing","errorCode":"ChangeFileEncoding.Error.TargetFilenameFieldMissing","errorMessage":"ChangeFileEncoding.Error.TargetFilenameFieldMissing","messagePattern":"ChangeFileEncoding\\.Error\\.TargetFilenameFieldMissing","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/changefileencoding/ChangeFileEncoding.java","lineNumber":81,"sourceCode":"      // no more input to be expected...\n      setOutputDone();\n      return false;\n    }\n\n    if ( first ) {\n      first = false;\n      // get the RowMeta\n      data.inputRowMeta = getInputRowMeta().clone();\n\n      // Check is source filename field is provided\n      if ( Utils.isEmpty( meta.getDynamicFilenameField() ) ) {\n        logError( BaseMessages.getString( PKG, \"ChangeFileEncoding.Error.FilenameFieldMissing\" ) );\n        throw new KettleException( BaseMessages.getString( PKG, \"ChangeFileEncoding.Error.FilenameFieldMissing\" ) );\n      }\n\n      // Check is target filename field is provided\n      if ( Utils.isEmpty( meta.getTargetFilenameField() ) ) {\n        throw new KettleException(\n            BaseMessages.getString( PKG, \"ChangeFileEncoding.Error.TargetFilenameFieldMissing\" ) );\n      }\n\n      // cache the position of the field\n      data.indexOfFileename = data.inputRowMeta.indexOfValue( meta.getDynamicFilenameField() );\n      if ( data.indexOfFileename < 0 ) {\n        // The field is unreachable !\n        logError( BaseMessages.getString( PKG, \"ChangeFileEncoding.Exception.CouldnotFindField\" ) + \"[\"\n            + meta.getDynamicFilenameField() + \"]\" );\n        throw new KettleException( BaseMessages.getString( PKG, \"ChangeFileEncoding.Exception.CouldnotFindField\",\n          meta.getDynamicFilenameField() ) );\n      }\n      // cache the position of the field\n      data.indexOfTargetFileename = data.inputRowMeta.indexOfValue( meta.getTargetFilenameField() );\n      if ( data.indexOfTargetFileename < 0 ) {\n        // The field is unreachable !\n        logError( BaseMessages.getString( PKG, \"ChangeFileEncoding.Exception.CouldnotFindField\" ) + \"[\"\n            + meta.getTargetFilenameField() + \"]\" );","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/changefileencoding/ChangeFileEncoding.java#L63-L99","documentation":"ChangeFileEncoding requires both a source filename field and a target filename field from the incoming row. It throws this localized KettleException when the 'target filename field' configuration is empty, because the step would have nowhere to write the re-encoded file.","triggerScenarios":"processRow, on the first row, when Utils.isEmpty(meta.getTargetFilenameField()) is true: the 'Target filename fieldname' box in the dialog is blank.","commonSituations":"Only the source field was configured; step cloned from a partially configured step; settings lost during an upgrade or XML/repository round-trip issue.","solutions":["Open the Change File Encoding step and set 'Target filename fieldname' to a field containing the output path (this can be the same field as the source for in-place conversion).","Ensure that field exists in the incoming row stream.","Re-save the transformation."],"exampleFix":"// before\ntargetFilenameField = null;\n// after\ntargetFilenameField = \"target_file\"; // or reuse \"source_file\" for in-place encoding","handlingStrategy":"validation","validationCode":"if (meta.getTargetFilenameField() == null || meta.getTargetFilenameField().isEmpty()) {\n  throw new IllegalArgumentException(\"ChangeFileEncoding: 'Target filename fieldname' must be set\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  // execute transformation\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"TargetFilenameFieldMissing\")) {\n    // set target filename field and re-run\n  } else { throw e; }\n}","preventionTips":["Set the target field at configuration time (can reuse the source field for in-place conversion)","Validate step config with the step's check/verify feature","Preview the stream to confirm the target field exists"],"tags":["kettle","configuration","missing-field"],"backgroundTag":"missing-required-config-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"}