{"record":{"id":"ffd237addcaa3e3b","repo":"pentaho/pentaho-kettle","slug":"unknown-result-type-option-resulttype","errorCode":null,"errorMessage":"Unknown result type option '<resultType>'","messagePattern":"Unknown result type option '<resultType>'","errorType":"exception","errorClass":"KettleValueException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/row/ValueDataUtil.java","lineNumber":1618,"sourceCode":"\n      long endL = endDateCal.getTimeInMillis() + endDateCal.getTimeZone().getOffset( endDateCal.getTimeInMillis() );\n      long startL = stDateCal.getTimeInMillis() + stDateCal.getTimeZone().getOffset( stDateCal.getTimeInMillis() );\n      long diff = endL - startL;\n\n      if ( Utils.isEmpty( resultType ) ) {\n        return new Long( diff / 86400000 );\n      } else if ( resultType.equals( \"ms\" ) ) {\n        return new Long( diff );\n      } else if ( resultType.equals( \"s\" ) ) {\n        return new Long( diff / 1000 ); // second\n      } else if ( resultType.equals( \"mn\" ) ) {\n        return new Long( diff / 60000 ); // minute\n      } else if ( resultType.equals( \"h\" ) ) {\n        return new Long( diff / 3600000 ); // hour\n      } else if ( resultType.equals( \"d\" ) ) {\n        return new Long( diff / 86400000 );\n      } else {\n        throw new KettleValueException( \"Unknown result type option '\" + resultType + \"'\" );\n      }\n    } else {\n      return null;\n    }\n  }\n\n  public static Object DateWorkingDiff( ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB,\n    Object dataB ) throws KettleValueException {\n    if ( dataA != null && dataB != null ) {\n      Date fromDate = metaB.getDate( dataB );\n      Date toDate = metaA.getDate( dataA );\n      boolean singminus = false;\n\n      if ( fromDate.after( toDate ) ) {\n        singminus = true;\n        Date temp = fromDate;\n        fromDate = toDate;\n        toDate = temp;","sourceCodeStart":1600,"sourceCodeEnd":1636,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/row/ValueDataUtil.java#L1600-L1636","documentation":"ValueDataUtil.DateDiff validates its resultType argument against the known units s/m/h/d (seconds, minutes, hours, days). Any other string reaches the final else and throws this KettleValueException naming the offending value.","triggerScenarios":"Calling ValueDataUtil.dateDiff(metaA, dataA, metaB, dataB, resultType) with resultType not exactly one of \"s\", \"m\", \"h\", \"d\" — e.g. \"S\", \"seconds\", \"ms\", \"y\" or a null-but-nonempty variant from a variable substitution.","commonSituations":"Calculator/UDF step configured with a unit spelled out ('minutes') instead of the single-letter code; a transformation variable used for the unit is unset or mistyped; case-sensitivity surprise ('M' vs 'm').","solutions":["Pass exactly one of \"s\", \"m\", \"h\", \"d\" (lowercase, single letter) as resultType","Check the step configuration/variable supplying the unit and fix its value","Validate/normalize the unit string before calling: lower-case it and map full words to the codes","For finer units (ms, weeks, months) do the arithmetic yourself from the ms diff instead of passing an unsupported code"],"exampleFix":"// before\nObject diff = ValueDataUtil.dateDiff( metaA, dA, metaB, dB, \"minutes\" );\n// after\nString unit = \"minutes\".startsWith( \"m\" ) ? \"m\" : \"minutes\"; // map to supported code\nObject diff = ValueDataUtil.dateDiff( metaA, dA, metaB, dB, unit ); // \"s\"|\"m\"|\"h\"|\"d\"","handlingStrategy":"validation","validationCode":"java.util.Arrays.asList( \"s\", \"m\", \"h\", \"d\" ).contains( resultType ); // false => fix before calling","typeGuard":"boolean isSupportedDiffUnit( String u ) { return u != null && u.matches( \"[smhd]\" ); }","tryCatchPattern":"if ( !isSupportedDiffUnit( resultType ) ) {\n  throw new IllegalArgumentException( \"resultType must be s|m|h|d, got: \" + resultType );\n}\nreturn ValueDataUtil.dateDiff( metaA, dataA, metaB, dataB, resultType );","preventionTips":["Never pass spelled-out units; only single lowercase letters s/m/h/d","Normalize user/variable-supplied units: trim, toLowerCase, map synonyms","If units come from variables, validate them once at transformation init"],"tags":["datediff","invalid-argument","kettle"],"backgroundTag":"invalid-enum-value","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"}