{"record":{"id":"5fe641e6d74aedfd","repo":"pentaho/pentaho-kettle","slug":"unable-to-find-value-metadata-with-name-valuename-so-i-can-t","errorCode":null,"errorMessage":"Unable to find value metadata with name '${valueName}', so I can't delete it.","messagePattern":"Unable to find value metadata with name '(.+?)', so I can't delete it\\.","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":792,"sourceCode":"  @Override\n  public void clear() {\n    lock.writeLock().lock();\n    try {\n      valueMetaList.clear();\n      cache.invalidate();\n      needRealClone = null;\n    } finally {\n      lock.writeLock().unlock();\n    }\n  }\n\n  @Override\n  public void removeValueMeta( String valueName ) throws KettleValueException {\n    lock.writeLock().lock();\n    try {\n      int index = indexOfValue( valueName );\n      if ( index < 0 ) {\n        throw new KettleValueException( \"Unable to find value metadata with name '\"\n          + valueName + \"', so I can't delete it.\" );\n      }\n      removeValueMeta( index );\n    } finally {\n      lock.writeLock().unlock();\n    }\n  }\n\n  @Override\n  public void removeValueMeta( int index ) {\n    lock.writeLock().lock();\n    try {\n      ValueMetaInterface old = valueMetaList.remove( index );\n      if ( old != null ) {\n        cache.removeMapping( old.getName() );\n        cache.updateFrom( index, valueMetaList );\n      }\n      needRealClone = null;","sourceCodeStart":774,"sourceCodeEnd":810,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/row/RowMeta.java#L774-L810","documentation":"removeValueMeta(String) looks up the field index by name via indexOfValue; if no field with that name exists (index < 0), it throws KettleValueException saying it cannot delete the missing value metadata. The message interpolates the requested name, making it easy to spot typos or case mismatches.","triggerScenarios":"rowMeta.removeValueMeta(\"fieldName\") where fieldName is misspelled, differs in case, was already removed, or never existed in this RowMeta (e.g. after a mapping/field-filter step renamed or dropped it upstream).","commonSituations":"Hardcoded field names drifting from transformation changes; case-sensitive lookups against fields renamed by a Select/Field-mapping step; running removeValueMeta twice on the same name; fields missing because upstream steps produced empty rows.","solutions":["Check indexOfValue(valueName) >= 0 before calling removeValueMeta, or wrap the call in try-catch for KettleValueException.","Verify the exact field name/case with searchValueMeta or by logging rowMeta.getFieldNames().","Guard with valueMeta != null / searchValueMeta first to make removal idempotent.","Fix upstream steps that rename or remove the field so it is present when this step runs."],"exampleFix":"// before\nrowMeta.removeValueMeta(\"CustomerID\"); // throws if absent\n// after\nif (rowMeta.indexOfValue(\"CustomerID\") >= 0) {\n  rowMeta.removeValueMeta(\"CustomerID\");\n}","handlingStrategy":"validation","validationCode":"if (rowMeta.indexOfValue(valueName) < 0) {\n  log.warn(\"Field '\" + valueName + \"' not present; skipping removal\");\n  return;\n}","typeGuard":null,"tryCatchPattern":"try {\n  rowMeta.removeValueMeta(valueName);\n} catch (KettleValueException e) {\n  log.warn(\"Field not found, skipping: \" + e.getMessage());\n}","preventionTips":["Always check indexOfValue() before removeValueMeta for idempotent removal.","Log rowMeta.getFieldNames() when debugging name mismatches.","Watch for case differences — lookups are case-sensitive.","Track upstream steps that rename or drop fields."],"tags":["row-metadata","field-lookup","remove-value-meta"],"backgroundTag":"entity-not-found","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"}