pentaho/pentaho-kettle · error · IOException

: Unknown storage type

Error message

 : Unknown storage type 

What it means

In ValueMetaBase.getXML, after mapping the data type, the storage type of the data object is mapped (NORMAL, BINARY_STRING, INDEXED). If getStorageType() returns an unrecognized value, an IOException with this message is thrown. It means the value meta carries a storage type that has no XML serialization rule.

Solutions

  1. Set the storage type explicitly to one of STORAGE_TYPE_NORMAL, STORAGE_TYPE_BINARY_STRING or STORAGE_TYPE_INDEXED before serializing.
  2. Validate/repair the metadata source (XML or stream) that contains the out-of-range storage type value.
  3. Remove or replace plugin-defined storage types with core storage types, or upgrade the plugin/engine to matching versions.
  4. Recreate the field metadata in Spoon to guarantee a valid storage type.

Example fix

// before: storageType left at an invalid value
vm.setStorageType(99);
// after
vm.setStorageType(ValueMetaInterface.STORAGE_TYPE_NORMAL);
Defensive patterns

Strategy: validation

Validate before calling

int st = vm.getStorageType();
if (st != STORAGE_TYPE_NORMAL && st != STORAGE_TYPE_BINARY_STRING && st != STORAGE_TYPE_INDEXED) {
  logError("Invalid storage type " + st + " on " + vm.getName());
  vm.setStorageType(STORAGE_TYPE_NORMAL);
}

Type guard

boolean hasKnownStorageType(ValueMetaInterface vm) {
  int st = vm.getStorageType();
  return st == ValueMetaInterface.STORAGE_TYPE_NORMAL
      || st == ValueMetaInterface.STORAGE_TYPE_BINARY_STRING
      || st == ValueMetaInterface.STORAGE_TYPE_INDEXED;
}

Try / catch

try {
  String xml = valueMeta.getXML();
} catch (IOException e) {
  if (e.getMessage().contains("Unknown storage type")) {
    valueMeta.setStorageType(ValueMetaInterface.STORAGE_TYPE_NORMAL);
    // retry serialization
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: Calling getMetaXML()/getXML() on a value meta whose storageType int is outside {STORAGE_TYPE_NORMAL, STORAGE_TYPE_BINARY_STRING, STORAGE_TYPE_INDEXED} — e.g. corrupted metadata, hand-edited XML, or a custom storage type added by a plugin the core writer does not handle.

Common situations: Manually edited transformation .ktr XML with an out-of-range storage-type attribute; plugin-defined storage types; metadata read from a stream written by an incompatible Kettle version.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/8a3e9add069d2c74. Report an issue: GitHub.

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java:3394

          case STORAGE_TYPE_BINARY_STRING:
            // Handle binary string content -- only when not NULL
            // In this case, we opt not to convert anything at all for speed.
            // That way, we can save on CPU power.
            // Since the streams can be compressed, volume shouldn't be an issue
            // at all.
            //
            string = XMLHandler.addTagValue( "binary-string", (byte[]) object );
            xml.append( XMLHandler.openTag( XML_DATA_TAG ) ).append( string ).append( XMLHandler.closeTag( XML_DATA_TAG ) );
            return xml.toString();

          case STORAGE_TYPE_INDEXED:
            // Just an index
            string = XMLHandler.addTagValue( "index-value", (Integer) object );
            break;

          default:
            throw new IOException( toString() + " : Unknown storage type " + getStorageType() );
        }
      } catch ( ClassCastException e ) {
        throw new RuntimeException( toString() + " : There was a data type error: the data type of "
            + object.getClass().getName() + " object [" + object + "] does not correspond to value meta ["
            + toStringMeta() + "]", e );
      } catch ( Exception e ) {
        throw new RuntimeException( toString() + " : there was a value XML encoding error", e );
      }
    } else {
      // If the object is null: give an empty string
      //
      string = "";
    }
    xml.append( XMLHandler.addTagValue( XML_DATA_TAG, string ) );

    return xml.toString();
  }

View on GitHub (pinned to f3058517a1)