pentaho/pentaho-kettle · error · KettleException

AvroInput.Error.CantLoadIncommingSchemaAndNoDefault

Error message

AvroInput.Error.CantLoadIncommingSchemaAndNoDefault

What it means

In setSchemaToUse, the step found a schema key on the row and tried to load the corresponding schema (from cache or repository), but loading failed AND no default datum reader is configured as a fallback. It throws this KettleException naming the schemaKey, since there is no way to decode the row.

Solutions

  1. Configure a default schema in the step so load failures fall back instead of throwing.
  2. Verify the schema key value emitted upstream matches a registered/cached schema exactly.
  3. Ensure the step (or earlier step) that registers the schema in the cache actually ran for this transformation.
  4. Log the schemaKey and list available cached schemas to find the mismatch.

Example fix

// before
throw new KettleException(..."CantLoadIncommingSchemaAndNoDefault", schemaKey);
// after: provide fallback schema at init so the else-branch never fires
m_defaultDatumReader = new GenericDatumReader<Object>(fallbackSchema);
Defensive patterns

Strategy: fallback

Validate before calling

// Check the key resolves to a known schema before processing
if (schemaCache.get(schemaKey) == null && defaultSchema == null) {
  throw new IllegalArgumentException("unknown schema key and no default: " + schemaKey);
}

Try / catch

try {
  rows = reader.avroObjectToKettle(row, space);
} catch (KettleException e) {
  if (e.getMessage().contains("CantLoadIncommingSchemaAndNoDefault")) { routeToErrorStream(row, e); } else throw e;
}

Prevention

When it happens

Trigger: schemaKey is non-empty; the lookup for the schema (cached schema load path) fails to produce a usable schema, the code cannot return early, and m_defaultDatumReader == null, so the exception is thrown with the offending key.

Common situations: Schema key referencing a schema that was never registered/cached (renamed or deleted); schema cache cleared between runs; typo in the key emitted by the producer; multi-step runs where the schema-defining step never executed.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroNestedReader.java:1668

        if ( m_log.isDetailed() ) {
          m_log.logDetailed(
            BaseMessages.getString( PKG, "AvroInput.Message.LoadingSchema", schemaKey ) );
        }
        try {
          toUse = loadSchema( m_bowl, schemaKey );
        } catch ( KettleException ex ) {
          // fall back to default (if possible)
          if ( m_defaultDatumReader != null ) {
            if ( m_log.isBasic() ) {
              m_log.logBasic( BaseMessages.getString( PKG,
                "AvroInput.Message.FailedToLoadSchmeaUsingDefault", schemaKey ) );
            }
            m_datumReader = m_defaultDatumReader;
            m_schemaToUse = m_datumReader.getSchema();
            setTopLevelStructure( m_defaultTopLevelObject );
            return;
          } else {
            throw new KettleException( BaseMessages.getString( PKG,
              "AvroInput.Error.CantLoadIncommingSchemaAndNoDefault", schemaKey ) );
          }
        }
      } else {
        // use the supplied schema
        if ( m_log.isDetailed() ) {
          m_log.logDetailed(
            BaseMessages.getString( PKG, "AvroInput.Message.ParsingSchema", schemaKey ) );
        }
        Schema.Parser p = new Schema.Parser();
        toUse = p.parse( schemaKey );
      }
      m_schemaToUse = toUse;
      m_datumReader = new GenericDatumReader( toUse );
      initTopLevelStructure( toUse, false );
      if ( useCache ) {
        Object[] schemaInfo = new Object[ 2 ];
        schemaInfo[ 0 ] = m_datumReader;

View on GitHub (pinned to f3058517a1)