pentaho/pentaho-kettle · error · SasReaderException

Unable to create new value meta type

Error message

Unable to create new value meta type

What it means

After mapping a SAS column to a Kettle type, the helper calls ValueMetaFactory.createValueMeta(name, kettleType); if that throws (invalid type code or name), the exception is wrapped in a SasReaderException with this message and the cause attached.

Solutions

  1. Check the chained cause to see why createValueMeta failed.
  2. Verify the kettleType value assigned for every case is a valid ValueMetaInterface.TYPE_* constant.
  3. Ensure the Pentaho Kettle version in use registers the type being requested.
  4. Fix the column name/metadata in the SAS file if the name is invalid.

Example fix

// before: int kettleType; // possibly unset for some branches
// after: int kettleType = ValueMetaInterface.TYPE_STRING; // safe default before switch
Defensive patterns

Strategy: try-catch

Validate before calling

// Ensure every mapped kettle type is a valid registered type
if (kettleType != ValueMetaInterface.TYPE_STRING && kettleType != ValueMetaInterface.TYPE_NUMBER) {
  throw new IllegalStateException("kettleType not set to a supported value: " + kettleType);
}

Try / catch

try {
  // load file layout
} catch (SasReaderException e) {
  if (e.getMessage().contains("Unable to create new value meta type")) {
    log.error("createValueMeta failed", e.getCause());
  }
  throw e;
}

Prevention

When it happens

Trigger: ValueMetaFactory.createValueMeta fails inside the column() callback — typically because kettleType was left at an invalid/uninitialized value (e.g. the unhandled-type path or a bad constant) or the name is unacceptable.

Common situations: A code change or mapping bug leaving kettleType invalid; Kettle version differences where a type constant is not registered with ValueMetaFactory; corrupted column metadata giving an empty name.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/sasinput/SasInputHelper.java:78

          switch ( type ) {
            case CHARACTER:
              kettleType = ValueMetaInterface.TYPE_STRING;
              kettleLength = length;
              break;
            case NUMERIC:
              kettleType = ValueMetaInterface.TYPE_NUMBER;
              kettleLength = -1;
              break;
            default:
              throw new RuntimeException( "Unhandled SAS data type encountered: " + type );
          }
          try {
            ValueMetaInterface valueMeta = ValueMetaFactory.createValueMeta( name, kettleType );
            valueMeta.setLength( kettleLength );
            valueMeta.setComments( label );
            rowMeta.addValueMeta( valueMeta );
          } catch ( Exception e ) {
            throw new SasReaderException( "Unable to create new value meta type", e );
          }
        }

        public boolean readData() {
          return false;
        }

        public boolean row( int rowNumber, Object[] rowData ) {
          return true;
        }
      } );
    } catch ( Exception e ) {
      throw new KettleException( "Unable to determine the layout of SAS7BAT file '" + filename + "'", e );
    }

  }

  @Override

View on GitHub (pinned to f3058517a1)