title: Kafka Streams - Unknown magic byte on GenericAvroSerde
body: <p>when trying to stream Avro data with Kafka Streams, I came across this error:   </p>
  
  <p><code>Exception in thread "StreamThread-1" org.apache.kafka.common.errors.SerializationException: Error deserializing Avro message for id -1
  Caused by: org.apache.kafka.common.errors.SerializationException: Unknown magic byte!</code></p>
  
  <p>Even though I found several older threads about it in the mailing list, none of the solutions stated there fixed the problem. So hopefully, I can find a solution here.</p>
  
  <p>My setup looks as follows:  </p>
  
  <pre class="lang-scala prettyprint-override"><code>StreamsConfig.KEY_SERDE_CLASS_CONFIG, Serdes.String.getClass.getName
  StreamsConfig.VALUE_SERDE_CLASS_CONFIG, classOf[GenericAvroSerde]   
  AbstractKafkaAvroSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG, localhost:8081)  
  </code></pre>
  
  <p>I already tried setting the <code>KEY_SERDE</code> to the same as the <code>VALUE_SERDE</code>, but even though this was "marked" as a solution in the Mailing list, it did not work in my case.</p>
  
  <p>I'm generating <code>GenericData.Record</code> with my Schema as follows:   </p>
  
  <pre><code>val record = new GenericData.Record(schema)
  ...
  record.put(field, value)
  </code></pre>
  
  <p>When I start the debug mode and check the generated record, everything looks fine, there is data in the record and the mapping is correct.   </p>
  
  <p>I stream the KStream like this (I used branch before):   </p>
  
  <p><code>splitTopics.get(0).to(s"${destTopic}_Testing")</code></p>
  
  <p>I'm using <code>GenericData.Record</code> for the records. Might this be a problem in combination with the <code>GenericAvroSerde</code>?</p>