{"record":{"id":"224f3f65dc67e1b4","repo":"pentaho/pentaho-kettle","slug":"i-don-t-know-how-to-convert-a-serializable-value-to-date","errorCode":null,"errorMessage":" : I don't know how to convert a serializable value to date.","messagePattern":" : I don't know how to convert a serializable value to date\\.","errorType":"exception","errorClass":"KettleValueException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java","lineNumber":2365,"sourceCode":"            throw new KettleValueException( toString() + \" : Unknown storage type \" + storageType + \" specified.\" );\n        }\n      case TYPE_BIGNUMBER:\n        switch ( storageType ) {\n          case STORAGE_TYPE_NORMAL:\n            return convertBigNumberToDate( (BigDecimal) object );\n          case STORAGE_TYPE_BINARY_STRING:\n            return convertBigNumberToDate( (BigDecimal) convertBinaryStringToNativeType( (byte[]) object ) );\n          case STORAGE_TYPE_INDEXED:\n            return convertBigNumberToDate( (BigDecimal) index[( (Integer) object ).intValue()] );\n          default:\n            throw new KettleValueException( toString() + \" : Unknown storage type \" + storageType + \" specified.\" );\n        }\n      case TYPE_BOOLEAN:\n        throw new KettleValueException( toString() + \" : I don't know how to convert a boolean to a date.\" );\n      case TYPE_BINARY:\n        throw new KettleValueException( toString() + \" : I don't know how to convert a binary value to date.\" );\n      case TYPE_SERIALIZABLE:\n        throw new KettleValueException( toString() + \" : I don't know how to convert a serializable value to date.\" );\n\n      default:\n        throw new KettleValueException( toString() + \" : Unknown type \" + type + \" specified.\" );\n    }\n  }\n\n  @Override\n  public byte[] getBinary( Object object ) throws KettleValueException {\n    if ( object == null ) {\n      return null;\n    }\n    switch ( type ) {\n      case TYPE_BINARY:\n        switch ( storageType ) {\n          case STORAGE_TYPE_NORMAL:\n            return (byte[]) object;\n          case STORAGE_TYPE_BINARY_STRING:\n            return (byte[]) object;","sourceCodeStart":2347,"sourceCodeEnd":2383,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java#L2347-L2383","documentation":"Kettle's ValueMetaBase.getDate() cannot convert a value whose metadata type is TYPE_SERIALIZABLE into a java.util.Date. Date conversion is only defined for string, number, integer, bignumber and date-typed values; any other declared type is refused with KettleValueException rather than producing a wrong date. The message is prefixed with the field's toString() so you can identify which field failed.","triggerScenarios":"Calling getDate(object) (or a step that requests a Date from a field, e.g. via getRow with date output) on a value meta whose type is ValueMetaInterface.TYPE_SERIALIZABLE, typically because a plugin or user-defined Java class step produced a serializable object field.","commonSituations":"User Defined Java Class / scripting steps emitting raw Java objects into the row stream; custom plugins producing serializable fields that downstream steps try to read as dates; field type changed upstream after a version upgrade.","solutions":["Fix the producing step so the field's value metadata declares TYPE_DATE and stores a Date object instead of a serializable object.","Insert an explicit conversion step that turns the object into a String/long first, then a Select Values type conversion to Date.","Catch KettleValueException around the getDate() call and handle non-date fields explicitly.","Use cloneToValueMeta/convertData with a TYPE_DATE value meta instead of calling getDate() directly on the serializable meta."],"exampleFix":"// before\nValueMetaInterface vm = new ValueMeta(\"obj\", ValueMetaInterface.TYPE_SERIALIZABLE);\nDate d = vm.getDate(rowData[0]); // throws\n// after\nValueMetaInterface vmDate = new ValueMeta(\"obj\", ValueMetaInterface.TYPE_DATE);\nDate d = (Date) vm.convertData(vm, rowData[0]);","handlingStrategy":"type-guard","validationCode":"if (meta.getType() == ValueMetaInterface.TYPE_SERIALIZABLE) { throw new IllegalArgumentException(\"Field \" + meta.getName() + \" is serializable; cannot getDate()\"); }","typeGuard":"boolean isDateReadable(ValueMetaInterface vm) { int t = vm.getType(); return t == ValueMetaInterface.TYPE_DATE || t == ValueMetaInterface.TYPE_STRING || t == ValueMetaInterface.TYPE_NUMBER || t == ValueMetaInterface.TYPE_INTEGER || t == ValueMetaInterface.TYPE_BIGNUMBER; }","tryCatchPattern":"try { Date d = vm.getDate(value); } catch (KettleValueException e) { log.warn(\"Not a date-convertible field: \" + e.getMessage()); }","preventionTips":["Check meta.getType() before calling typed getters.","Never emit raw serializable objects into shared row streams.","Use convertData() between value metas instead of direct typed getters.","Add a Select Values step to normalize field types early in the transformation."],"tags":["kettle","date-conversion","type-mismatch"],"backgroundTag":"incompatible-source-type","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"}