title: SerializationException: Error deserializing Avro message
body: <p>I got error when creating Kafka JdbcSinkConnector (my task is to transfer data from Kafka topic to Postgres table):</p>
  
  <blockquote>
    <p>Caused by: org.apache.kafka.common.errors.SerializationException:
    Error deserializing Avro message for id -1</p>
  </blockquote>
  
  <p>What does mean id -1?</p>
  
  <p>Settings for connector:</p>
  
  <pre><code>{
    "name": "MVM Test",
    "connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector",
    "key.converter": "org.apache.kafka.connect.json.JsonConverter",
    "errors.log.enable": "true",
    "errors.log.include.messages": "true",
    "topics": [
      "mvm_test_events"
    ],
    "connection.url": "jdbc:connection",
    "connection.user": "user",
    "connection.password": "*************"
  }
  </code></pre>
  
  <p>Also I described schema for (value) topic "mvm_test_events" in Control Center:</p>
  
  <pre><code>{
    "type": "record",
    "name": "event",
    "namespace": "mvm",
    "fields": [
      {
        "name": "id",
        "type": "int"
      },
      {
        "name": "series_storage",
        "type": "int"
      },
      {
        "name": "type",
        "type": "int"
      },
      {
        "name": "entity_id",
        "type": "int"
      },
      {
        "name": "processing_ts",
        "type": "double"
      },
      {
        "name": "from_ts",
        "type": "double"
      },
      {
        "name": "to_ts",
        "type": "string"
      },
      {
        "name": "context",
        "type": {
          "type": "record",
          "name": "context",
          "fields": [
            {
              "name": "trainName",
              "type": "string"
            }
          ]
        }
      }
    ]
  }
  </code></pre>
  
  <p>Error logs:</p>
  
  <pre><code>&gt; [2020-01-22 06:45:10,380] ERROR Error encountered in task
  &gt; mvm-test-events-0. Executing stage 'VALUE_CONVERTER' with class
  &gt; 'io.confluent.connect.avro.AvroConverter', where consumed record is
  &gt; {topic='mvm_test_events', partition=0, offset=14,
  &gt; timestamp=1579615711794, timestampType=CreateTime}.
  &gt; (org.apache.kafka.connect.runtime.errors.LogReporter)
  &gt; org.apache.kafka.connect.errors.DataException: Failed to deserialize
  &gt; data for topic mvm_test_events to Avro:   at
  &gt; io.confluent.connect.avro.AvroConverter.toConnectData(AvroConverter.java:107)
  &gt;   at
  &gt; org.apache.kafka.connect.runtime.WorkerSinkTask.lambda$convertAndTransformRecord$1(WorkerSinkTask.java:487)
  &gt;   at
  &gt; org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndRetry(RetryWithToleranceOperator.java:128)
  &gt;   at
  &gt; org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndHandleError(RetryWithToleranceOperator.java:162)
  &gt;   at
  &gt; org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execute(RetryWithToleranceOperator.java:104)
  &gt;   at
  &gt; org.apache.kafka.connect.runtime.WorkerSinkTask.convertAndTransformRecord(WorkerSinkTask.java:487)
  &gt;   at
  &gt; org.apache.kafka.connect.runtime.WorkerSinkTask.convertMessages(WorkerSinkTask.java:464)
  &gt;   at
  &gt; org.apache.kafka.connect.runtime.WorkerSinkTask.poll(WorkerSinkTask.java:320)
  &gt;   at
  &gt; org.apache.kafka.connect.runtime.WorkerSinkTask.iteration(WorkerSinkTask.java:224)
  &gt;   at
  &gt; org.apache.kafka.connect.runtime.WorkerSinkTask.execute(WorkerSinkTask.java:192)
  &gt;   at
  &gt; org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:175)
  &gt;   at
  &gt; org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:219)
  &gt;   at
  &gt; java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  &gt;   at java.util.concurrent.FutureTask.run(FutureTask.java:266)     at
  &gt; java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  &gt;   at
  &gt; java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  &gt;   at java.lang.Thread.run(Thread.java:748) Caused by:
  &gt; org.apache.kafka.common.errors.SerializationException: Error
  &gt; deserializing Avro message for id -1 Caused by:
  &gt; org.apache.kafka.common.errors.SerializationException: Unknown magic
  &gt; byte! [2020-01-22 06:45:10,381] ERROR
  &gt; WorkerSinkTask{id=mvm-test-events-0} Task threw an uncaught and
  &gt; unrecoverable exception (org.apache.kafka.connect.runtime.WorkerTask)
  &gt; org.apache.kafka.connect.errors.ConnectException: Tolerance exceeded
  &gt; in error handler  at
  &gt; org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndHandleError(RetryWithToleranceOperator.java:178)
  &gt;   at
  &gt; org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execute(RetryWithToleranceOperator.java:104)
  &gt;   at
  &gt; org.apache.kafka.connect.runtime.WorkerSinkTask.convertAndTransformRecord(WorkerSinkTask.java:487)
  &gt;   at
  &gt; org.apache.kafka.connect.runtime.WorkerSinkTask.convertMessages(WorkerSinkTask.java:464)
  &gt;   at
  &gt; org.apache.kafka.connect.runtime.WorkerSinkTask.poll(WorkerSinkTask.java:320)
  &gt;   at
  &gt; org.apache.kafka.connect.runtime.WorkerSinkTask.iteration(WorkerSinkTask.java:224)
  &gt;   at
  &gt; org.apache.kafka.connect.runtime.WorkerSinkTask.execute(WorkerSinkTask.java:192)
  &gt;   at
  &gt; org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:175)
  &gt;   at
  &gt; org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:219)
  &gt;   at
  &gt; java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  &gt;   at java.util.concurrent.FutureTask.run(FutureTask.java:266)     at
  &gt; java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  &gt;   at
  &gt; java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  &gt;   at java.lang.Thread.run(Thread.java:748) Caused by:
  &gt; org.apache.kafka.connect.errors.DataException: Failed to deserialize
  &gt; data for topic mvm_test_events to Avro:   at
  &gt; io.confluent.connect.avro.AvroConverter.toConnectData(AvroConverter.java:107)
  &gt;   at
  &gt; org.apache.kafka.connect.runtime.WorkerSinkTask.lambda$convertAndTransformRecord$1(WorkerSinkTask.java:487)
  &gt;   at
  &gt; org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndRetry(RetryWithToleranceOperator.java:128)
  &gt;   at
  &gt; org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndHandleError(RetryWithToleranceOperator.java:162)
  &gt;   ... 13 more Caused by:
  &gt; org.apache.kafka.common.errors.SerializationException: Error
  &gt; deserializing Avro message for id -1 Caused by:
  &gt; org.apache.kafka.common.errors.SerializationException: Unknown magic
  &gt; byte! [2020-01-22 06:45:10,381] ERROR
  &gt; WorkerSinkTask{id=mvm-test-events-0} Task is being killed and will not
  &gt; recover until manually restarted
  &gt; (org.apache.kafka.connect.runtime.WorkerTask)
  </code></pre>
  
  <p>As far as I can see it tries to convert record in topic with io.confluent.connect.avro.AvroConverter. Now should I define the schema (I described in topic settings) name in connector setting "Value converter class"?</p>