{"record":{"id":"8ad184ab94008e9c","repo":"pentaho/pentaho-kettle","slug":"tostring-unknown-storage-type-storagetype-specified","errorCode":null,"errorMessage":"<toString()> : Unknown storage type <storageType> specified.","messagePattern":"<toString\\(\\)> : Unknown storage type <storageType> specified\\.","errorType":"exception","errorClass":"KettleValueException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java","lineNumber":1731,"sourceCode":"\n      switch ( type ) {\n        case TYPE_DATE:\n          switch ( storageType ) {\n            case STORAGE_TYPE_NORMAL:\n              string = convertDateToCompatibleString( (Date) object );\n              break;\n            case STORAGE_TYPE_BINARY_STRING:\n              string = convertDateToCompatibleString( (Date) convertBinaryStringToNativeType( (byte[]) object ) );\n              break;\n            case STORAGE_TYPE_INDEXED:\n              if ( object == null ) {\n                string = null;\n              } else {\n                string = convertDateToCompatibleString( (Date) index[( (Integer) object ).intValue()] );\n              }\n              break;\n            default:\n              throw new KettleValueException( toString() + \" : Unknown storage type \" + storageType + \" specified.\" );\n          }\n          break;\n\n        case TYPE_NUMBER:\n          switch ( storageType ) {\n            case STORAGE_TYPE_NORMAL:\n              string = convertNumberToCompatibleString( (Double) object );\n              break;\n            case STORAGE_TYPE_BINARY_STRING:\n              string = convertNumberToCompatibleString( (Double) convertBinaryStringToNativeType( (byte[]) object ) );\n              break;\n            case STORAGE_TYPE_INDEXED:\n              string =\n                  object == null ? null : convertNumberToCompatibleString( (Double) index[( (Integer) object )\n                      .intValue()] );\n              break;\n            default:\n              throw new KettleValueException( toString() + \" : Unknown storage type \" + storageType + \" specified.\" );","sourceCodeStart":1713,"sourceCodeEnd":1749,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java#L1713-L1749","documentation":"ValueMetaBase converts a Kettle value to its string form based on the value's storageType. When the storage type is not one of the known constants (STORAGE_TYPE_NORMAL, STORAGE_TYPE_INDEXED, STORAGE_TYPE_BINARY_STRING), the switch falls through to its default arm and throws KettleValueException. This is a metadata-corruption / invalid-value-meta-state error: the ValueDataInterface object and the metadata disagree on how the raw data is stored.","triggerScenarios":"Calling toString()/getString() on a ValueMeta whose storageType field was set to an unrecognized integer (anything other than 0=NORMAL, 1=INDEXED, 2=BINARY_STRING) while the field's data type is TYPE_DATE; typically after hand-built ValueMeta objects, bad setStorageType() arguments, or corrupted serialized transformation metadata.","commonSituations":"Custom plugin code constructing ValueMetaBase directly with a wrong storage type constant; legacy transformations saved by old Pentaho versions whose metadata round-trips into an invalid storage type; index-based storage (STORAGE_TYPE_INDEXED) metadata combined with a data type whose switch arm doesn't cover the actual value.","solutions":["Verify the ValueMeta's storageType with valueMeta.getStorageType() and set it to a valid constant: ValueMetaInterface.STORAGE_TYPE_NORMAL, STORAGE_TYPE_INDEXED, or STORAGE_TYPE_BINARY_STRING","If you only need string output, call valueMeta.getStorageType() and normalize invalid values to STORAGE_TYPE_NORMAL before conversion","Re-serialize/rebuild the transformation or step metadata that produced the invalid ValueMeta instead of hand-editing stored metadata","Upgrade/align the Pentaho Kettle (PDI) version used to write and read the transformation to avoid metadata incompatibilities"],"exampleFix":"// before\nValueMetaBase meta = new ValueMetaBase(\"d\", ValueMetaInterface.TYPE_DATE);\nmeta.setStorageType(42); // invalid\nString s = meta.toString(data); // throws\n// after\nmeta.setStorageType(ValueMetaInterface.STORAGE_TYPE_NORMAL);\nString s = meta.toString(data);","handlingStrategy":"validation","validationCode":"private static boolean hasValidStorageType(ValueMetaInterface m) {\n  int st = m.getStorageType();\n  return st == ValueMetaInterface.STORAGE_TYPE_NORMAL\n      || st == ValueMetaInterface.STORAGE_TYPE_INDEXED\n      || st == ValueMetaInterface.STORAGE_TYPE_BINARY_STRING;\n}\n// call before conversion: if (!hasValidStorageType(meta)) meta.setStorageType(ValueMetaInterface.STORAGE_TYPE_NORMAL);","typeGuard":"boolean isValidStorageType(ValueMetaInterface m) {\n  switch (m.getStorageType()) {\n    case ValueMetaInterface.STORAGE_TYPE_NORMAL:\n    case ValueMetaInterface.STORAGE_TYPE_INDEXED:\n    case ValueMetaInterface.STORAGE_TYPE_BINARY_STRING:\n      return true;\n    default:\n      return false;\n  }\n}","tryCatchPattern":"try {\n  String s = meta.toString(data);\n} catch (KettleValueException e) {\n  logError(\"Invalid storage type on field \" + meta.getName() + \": \" + e.getMessage());\n  meta.setStorageType(ValueMetaInterface.STORAGE_TYPE_NORMAL);\n  String s = meta.toString(data); // retry with corrected metadata\n}","preventionTips":["Always initialize ValueMeta with an explicit STORAGE_TYPE constant, never STORAGE_TYPE_DEFAULT","Use the ValueMetaInterface.STORAGE_TYPE_* constants instead of magic integers","Validate row metadata (RowMetaInterface) at step init before processing rows","Re-save legacy transformations in the current PDI version to normalize stored metadata"],"tags":["kettle","value-metadata","storage-type","enum"],"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"}