{"record":{"id":"277d915f7711142d","repo":"pentaho/pentaho-kettle","slug":"i-don-t-know-how-to-convert-serializable-values-to-integers","errorCode":null,"errorMessage":" : I don't know how to convert serializable values to integers.","messagePattern":" : I don't know how to convert serializable values to integers\\.","errorType":"exception","errorClass":"KettleValueException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java","lineNumber":2130,"sourceCode":"              return new Long( ( (BigDecimal) index[( (Integer) object ).intValue()] ).longValue() );\n            default:\n              throw new KettleValueException( toString() + \" : Unknown storage type \" + storageType + \" specified.\" );\n          }\n        case TYPE_BOOLEAN:\n          switch ( storageType ) {\n            case STORAGE_TYPE_NORMAL:\n              return convertBooleanToInteger( (Boolean) object );\n            case STORAGE_TYPE_BINARY_STRING:\n              return convertBooleanToInteger( (Boolean) convertBinaryStringToNativeType( (byte[]) object ) );\n            case STORAGE_TYPE_INDEXED:\n              return convertBooleanToInteger( (Boolean) index[( (Integer) object ).intValue()] );\n            default:\n              throw new KettleValueException( toString() + \" : Unknown storage type \" + storageType + \" specified.\" );\n          }\n        case TYPE_BINARY:\n          throw new KettleValueException( toString() + \" : I don't know how to convert binary values to integers.\" );\n        case TYPE_SERIALIZABLE:\n          throw new KettleValueException( toString()\n              + \" : I don't know how to convert serializable values to integers.\" );\n        default:\n          throw new KettleValueException( toString() + \" : Unknown type \" + type + \" specified.\" );\n      }\n    } catch ( Exception e ) {\n      throw new KettleValueException( \"Unexpected conversion error while converting value [\" + toString()\n          + \"] to an Integer\", e );\n    }\n  }\n\n  @Override\n  public BigDecimal getBigNumber( Object object ) throws KettleValueException {\n    try {\n      if ( isNull( object ) ) {\n        return null;\n      }\n      switch ( type ) {\n        case TYPE_BIGNUMBER:","sourceCodeStart":2112,"sourceCodeEnd":2148,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java#L2112-L2148","documentation":"ValueMetaBase.getInteger() refuses to convert values whose metadata type is TYPE_SERIALIZABLE (arbitrary Java objects) to a Long. No meaningful generic object-to-integer conversion exists, so KettleValueException is thrown. It signals that the field holds a serialized/plain Java object and numeric access is not supported.","triggerScenarios":"Calling getInteger(Object) on a ValueMetaBase configured with type ValueMetaInterface.TYPE_SERIALIZABLE and a non-null object. Typical when rows carry custom objects (e.g. Kettle metadata objects) between steps and a downstream step tries numeric access.","commonSituations":"Steps passing POJOs or metadata objects (like ValueMeta itself, database connections) through the row stream; user-defined Java class step outputting objects; incorrectly configured field type on a UserDefinedJavaClass or custom plugin step.","solutions":["Give the field a concrete numeric type (TYPE_INTEGER/TYPE_NUMBER) and put a numeric value in it","If the object has a numeric property, extract and convert it explicitly before calling getInteger","Inspect the row metadata (rowMeta.getValueMeta(i).getType()) and avoid numeric access for serializable fields; filter them out or pass them opaquely"],"exampleFix":"// before\nValueMetaInterface meta = new ValueMetaBase(\"obj\", ValueMetaInterface.TYPE_SERIALIZABLE);\nLong n = meta.getInteger(object); // throws\n// after\nif (meta.getType() == ValueMetaInterface.TYPE_SERIALIZABLE) {\n  MyThing t = (MyThing) object;\n  Long n = t.getCount(); // extract the numeric yourself\n}","handlingStrategy":"validation","validationCode":"if (meta.getType() == ValueMetaInterface.TYPE_SERIALIZABLE) {\n  throw new IllegalArgumentException(\"Field \" + meta.getName() + \" holds objects; no numeric conversion\");\n}\nLong n = meta.getInteger(object);","typeGuard":"boolean isSerializable(ValueMetaInterface m) {\n  return m.getType() == ValueMetaInterface.TYPE_SERIALIZABLE;\n}","tryCatchPattern":"try {\n  Long n = meta.getInteger(object);\n} catch (KettleValueException e) {\n  log.warn(\"Skipping serializable field \" + meta.getName() + \": \" + e.getMessage());\n  n = null;\n}","preventionTips":["Treat TYPE_SERIALIZABLE fields as opaque; pass them through untouched","Extract numbers from the object explicitly before numeric access","Keep serializable fields out of arithmetic/mapping steps","Document row metadata contracts between your steps"],"tags":["kettle","pdi","type-conversion","serializable"],"backgroundTag":"unsupported-operation","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"}