{"record":{"id":"ff5cd0c33233dc40","repo":"pentaho/pentaho-kettle","slug":"avroinput-error-cantloadincommingschemaandnodefault","errorCode":null,"errorMessage":"AvroInput.Error.CantLoadIncommingSchemaAndNoDefault","messagePattern":"AvroInput\\.Error\\.CantLoadIncommingSchemaAndNoDefault","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroNestedReader.java","lineNumber":1668,"sourceCode":"        if ( m_log.isDetailed() ) {\n          m_log.logDetailed(\n            BaseMessages.getString( PKG, \"AvroInput.Message.LoadingSchema\", schemaKey ) );\n        }\n        try {\n          toUse = loadSchema( m_bowl, schemaKey );\n        } catch ( KettleException ex ) {\n          // fall back to default (if possible)\n          if ( m_defaultDatumReader != null ) {\n            if ( m_log.isBasic() ) {\n              m_log.logBasic( BaseMessages.getString( PKG,\n                \"AvroInput.Message.FailedToLoadSchmeaUsingDefault\", schemaKey ) );\n            }\n            m_datumReader = m_defaultDatumReader;\n            m_schemaToUse = m_datumReader.getSchema();\n            setTopLevelStructure( m_defaultTopLevelObject );\n            return;\n          } else {\n            throw new KettleException( BaseMessages.getString( PKG,\n              \"AvroInput.Error.CantLoadIncommingSchemaAndNoDefault\", schemaKey ) );\n          }\n        }\n      } else {\n        // use the supplied schema\n        if ( m_log.isDetailed() ) {\n          m_log.logDetailed(\n            BaseMessages.getString( PKG, \"AvroInput.Message.ParsingSchema\", schemaKey ) );\n        }\n        Schema.Parser p = new Schema.Parser();\n        toUse = p.parse( schemaKey );\n      }\n      m_schemaToUse = toUse;\n      m_datumReader = new GenericDatumReader( toUse );\n      initTopLevelStructure( toUse, false );\n      if ( useCache ) {\n        Object[] schemaInfo = new Object[ 2 ];\n        schemaInfo[ 0 ] = m_datumReader;","sourceCodeStart":1650,"sourceCodeEnd":1686,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroNestedReader.java#L1650-L1686","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Configure a default schema in the step so load failures fall back instead of throwing.","Verify the schema key value emitted upstream matches a registered/cached schema exactly.","Ensure the step (or earlier step) that registers the schema in the cache actually ran for this transformation.","Log the schemaKey and list available cached schemas to find the mismatch."],"exampleFix":"// before\nthrow new KettleException(...\"CantLoadIncommingSchemaAndNoDefault\", schemaKey);\n// after: provide fallback schema at init so the else-branch never fires\nm_defaultDatumReader = new GenericDatumReader<Object>(fallbackSchema);","handlingStrategy":"fallback","validationCode":"// Check the key resolves to a known schema before processing\nif (schemaCache.get(schemaKey) == null && defaultSchema == null) {\n  throw new IllegalArgumentException(\"unknown schema key and no default: \" + schemaKey);\n}","typeGuard":null,"tryCatchPattern":"try {\n  rows = reader.avroObjectToKettle(row, space);\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"CantLoadIncommingSchemaAndNoDefault\")) { routeToErrorStream(row, e); } else throw e;\n}","preventionTips":["Register a default schema as a safety net for cache misses.","Keep schema keys stable across producer/consumer deployments.","Warm the schema cache before the main flow runs."],"tags":["avro","schema","cache","configuration"],"backgroundTag":"resource-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"}