{"record":{"id":"8e79b2d9e2c099d0","repo":"pentaho/pentaho-kettle","slug":"unable-to-create-new-value-meta-type","errorCode":null,"errorMessage":"Unable to create new value meta type","messagePattern":"Unable to create new value meta type","errorType":"exception","errorClass":"SasReaderException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/sasinput/SasInputHelper.java","lineNumber":78,"sourceCode":"          switch ( type ) {\n            case CHARACTER:\n              kettleType = ValueMetaInterface.TYPE_STRING;\n              kettleLength = length;\n              break;\n            case NUMERIC:\n              kettleType = ValueMetaInterface.TYPE_NUMBER;\n              kettleLength = -1;\n              break;\n            default:\n              throw new RuntimeException( \"Unhandled SAS data type encountered: \" + type );\n          }\n          try {\n            ValueMetaInterface valueMeta = ValueMetaFactory.createValueMeta( name, kettleType );\n            valueMeta.setLength( kettleLength );\n            valueMeta.setComments( label );\n            rowMeta.addValueMeta( valueMeta );\n          } catch ( Exception e ) {\n            throw new SasReaderException( \"Unable to create new value meta type\", e );\n          }\n        }\n\n        public boolean readData() {\n          return false;\n        }\n\n        public boolean row( int rowNumber, Object[] rowData ) {\n          return true;\n        }\n      } );\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to determine the layout of SAS7BAT file '\" + filename + \"'\", e );\n    }\n\n  }\n\n  @Override","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/sasinput/SasInputHelper.java#L60-L96","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the chained cause to see why createValueMeta failed.","Verify the kettleType value assigned for every case is a valid ValueMetaInterface.TYPE_* constant.","Ensure the Pentaho Kettle version in use registers the type being requested.","Fix the column name/metadata in the SAS file if the name is invalid."],"exampleFix":"// before: int kettleType; // possibly unset for some branches\n// after: int kettleType = ValueMetaInterface.TYPE_STRING; // safe default before switch","handlingStrategy":"try-catch","validationCode":"// Ensure every mapped kettle type is a valid registered type\nif (kettleType != ValueMetaInterface.TYPE_STRING && kettleType != ValueMetaInterface.TYPE_NUMBER) {\n  throw new IllegalStateException(\"kettleType not set to a supported value: \" + kettleType);\n}","typeGuard":null,"tryCatchPattern":"try {\n  // load file layout\n} catch (SasReaderException e) {\n  if (e.getMessage().contains(\"Unable to create new value meta type\")) {\n    log.error(\"createValueMeta failed\", e.getCause());\n  }\n  throw e;\n}","preventionTips":["Initialize kettleType to a safe default (TYPE_STRING) before the switch.","Keep Kettle plugin and platform versions aligned so ValueMetaFactory knows all requested types.","Validate column names from the SAS file are non-empty before creating value metas."],"tags":["sas","value-meta","initialization","etl"],"backgroundTag":"internal-invariant-violation","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"}