{"record":{"id":"6abe96d9ee54f27d","repo":"pentaho/pentaho-kettle","slug":"unable-to-serialize-indexe-storage-type-for-data-type","errorCode":null,"errorMessage":" : Unable to serialize indexe storage type for data type ","messagePattern":" : Unable to serialize indexe storage type for data type ","errorType":"exception","errorClass":"KettleFileException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java","lineNumber":3013,"sourceCode":"                    writeNumber( outputStream, (Double) index[i] );\n                    break;\n                  case TYPE_INTEGER:\n                    writeInteger( outputStream, (Long) index[i] );\n                    break;\n                  case TYPE_DATE:\n                    writeDate( outputStream, (Date) index[i] );\n                    break;\n                  case TYPE_BIGNUMBER:\n                    writeBigNumber( outputStream, (BigDecimal) index[i] );\n                    break;\n                  case TYPE_BOOLEAN:\n                    writeBoolean( outputStream, (Boolean) index[i] );\n                    break;\n                  case TYPE_BINARY:\n                    writeBinary( outputStream, (byte[]) index[i] );\n                    break;\n                  default:\n                    throw new KettleFileException( toString()\n                        + \" : Unable to serialize indexe storage type for data type \" + getType() );\n                }\n              } catch ( ClassCastException e ) {\n                throw new RuntimeException( toString() + \" : There was a data type error: the data type of \"\n                    + index[i].getClass().getName() + \" object [\" + index[i] + \"] does not correspond to value meta [\"\n                    + toStringMeta() + \"]\" );\n              }\n            }\n          }\n          break;\n\n        case STORAGE_TYPE_BINARY_STRING:\n          // Save the storage meta data...\n          //\n          outputStream.writeBoolean( storageMetadata != null );\n\n          if ( storageMetadata != null ) {\n            storageMetadata.writeMeta( outputStream );","sourceCodeStart":2995,"sourceCodeEnd":3031,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java#L2995-L3031","documentation":"KettleFileException thrown by ValueMetaBase.writeData for STORAGE_TYPE_INDEXED values when an individual index entry's type is not serializable by the writer's inner switch (unsupported for String, Number, Integer, Date, Boolean, Binary, BigNumber, etc.). It indicates an index table containing values of a data type the binary writer cannot serialize.","triggerScenarios":"writeData() on an indexed ValueMeta whose index array holds, e.g., java.util.Date subclasses, BigDecimal beyond supported cases, or arbitrary objects; the inner default branch throws for that element's type.","commonSituations":"Building indexed storage types from lookup tables containing unsupported classes; metadata generated by custom code or plugins with mixed-type index arrays.","solutions":["Ensure every element in the index array is of a type supported by writeData (String, Long/Integer, Double, Date, Boolean, byte[], BigDecimal, InetAddress)","Convert unsupported index entries to supported types when building the indexed value meta","Fall back to STORAGE_TYPE_NORMAL for values whose types the indexed writer cannot handle"],"exampleFix":"// before\nindex[i] = new Timestamp(...); // not matched by writer switch\n// after\nif (index[i] instanceof Timestamp) {\n  index[i] = new Date(((Timestamp) index[i]).getTime());\n}","handlingStrategy":"validation","validationCode":"// Validate every index entry before assigning an indexed storage type:\nstatic void validateIndexedEntries(ValueMetaInterface vmi, Object[] index) throws KettleFileException {\n  for (int i = 0; i < index.length; i++) {\n    Object o = index[i];\n    if (o == null) continue;\n    Class<?> expected = expectedClassFor(vmi.getType());\n    if (!expected.isInstance(o)) {\n      throw new KettleFileException(\"Index entry \" + i + \" expects \" + expected.getName()\n          + \" but is \" + o.getClass().getName());\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  valueMeta.writeData(out, object);\n} catch (KettleFileException e) {\n  if (String.valueOf(e.getMessage()).contains(\"Unable to serialize indexe\")) {\n    LOG.error(\"Indexed field \" + valueMeta.getName() + \" has an unsupported entry type\");\n    // convert entries to supported classes or switch storage type and retry\n  } else { throw e; }\n}","preventionTips":["Build index arrays only with the exact classes the value meta's type maps to","Convert Timestamp to Date, Integer to Long, etc., when populating lookup tables","Prefer STORAGE_TYPE_NORMAL unless the indexed-encoding performance benefit is measured and needed","Unit-test writeData/readData round-trips for indexed value metas"],"tags":["kettle","pdi","serialization","indexed-storage","unsupported-type"],"backgroundTag":"unsupported-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"}