{"record":{"id":"7f36306054ff3886","repo":"pentaho/pentaho-kettle","slug":"kettlevalueexception-wrapping-kettlepluginexception-from","errorCode":null,"errorMessage":"KettleValueException wrapping KettlePluginException from cloneToType (no message; cause carries detail)","messagePattern":"KettleValueException wrapping KettlePluginException from cloneToType \\(no message; cause carries detail\\)","errorType":"exception","errorClass":"org.pentaho.di.core.exception.KettleValueException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/row/RowMeta.java","lineNumber":108,"sourceCode":"    } finally {\n      lock.readLock().unlock();\n    }\n  }\n\n  /**\n   * This method copies the row metadata and sets all values to the specified type (usually String)\n   *\n   * @param targetType The target type\n   * @return The cloned metadata\n   * @throws if the target type could not be loaded from the plugin registry\n   */\n  @Override\n  public RowMetaInterface cloneToType( int targetType ) throws KettleValueException {\n    lock.readLock().lock();\n    try {\n      return new RowMeta( this, targetType );\n    } catch ( KettlePluginException e ) {\n      throw new KettleValueException( e );\n    } finally {\n      lock.readLock().unlock();\n    }\n  }\n\n  @Override\n  public String toString() {\n    StringBuilder buffer = new StringBuilder();\n    lock.readLock().lock();\n    try {\n      boolean notFirst = false;\n      for ( ValueMetaInterface valueMeta : valueMetaList ) {\n        if ( notFirst ) {\n          buffer.append( \", \" );\n        } else {\n          notFirst = true;\n        }\n        buffer.append( \"[\" ).append( valueMeta.toString() ).append( \"]\" );","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/row/RowMeta.java#L90-L126","documentation":"cloneToType creates a new RowMeta of a target type (e.g. to clone metadata between binary/string representations). The RowMeta copy constructor may throw KettlePluginException when ValueMetaFactory cannot create a value meta of the requested type. RowMeta translates that into a KettleValueException because cloneToType's signature only declares KettleValueException; the root cause and its message are carried on the exception's cause.","triggerScenarios":"Calling rowMeta.cloneToType(ValueMetaInterface.TYPE_...) where cloning a value meta requires the plugin factory to instantiate a value class that is missing, not registered, or whose constructor fails (e.g. an unknown/removed value type plugin on the classpath).","commonSituations":"PDI plugin jar missing from plugins/ directory so a custom value type cannot be instantiated; version mismatch where a value type class was renamed/moved between Pentaho/PDI versions; classloader issues when embedding Kettle in an application.","solutions":["Inspect getCause() of the KettleValueException to find the underlying KettlePluginException detail message.","Verify all Kettle value-type plugin jars are present on the classpath / in the plugins directory.","Ensure the PDI core and plugin versions match the target value type; upgrade/downgrade to a consistent set of jars.","If wrapping a custom ValueMeta, confirm its class is public, has a no-arg/copy constructor, and is registered with ValueMetaFactory."],"exampleFix":"// before\nRowMetaInterface stringClone = rowMeta.cloneToType(ValueMetaInterface.TYPE_STRING);\n// after\ntry {\n  RowMetaInterface stringClone = rowMeta.cloneToType(ValueMetaInterface.TYPE_STRING);\n} catch (KettleValueException e) {\n  log.error(\"cloneToType failed: \" + (e.getCause() != null ? e.getCause().getMessage() : e.getMessage()), e);\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":"if (rowMeta == null || rowMeta.size() == 0) { throw new IllegalStateException(\"Cannot clone empty RowMeta\"); }","typeGuard":null,"tryCatchPattern":"try {\n  RowMetaInterface clone = rowMeta.cloneToType(ValueMetaInterface.TYPE_STRING);\n} catch (KettleValueException e) {\n  Throwable cause = e.getCause();\n  log.error(\"cloneToType failed: \" + (cause != null ? cause.getMessage() : e.getMessage()), e);\n}","preventionTips":["Ship all value-type plugin jars with your PDI installation.","Keep PDI core and plugin versions consistent.","Log e.getCause() rather than only the wrapper's (empty) message."],"tags":["row-metadata","plugin","value-type","clone"],"backgroundTag":"missing-dependency","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"}