title: Kafka Connect: java.lang.IllegalStateException: No current assignment for partition
body: <p>I'm running Kafka Connect on Kubernetes (8-16 nodes, autoscaled). I've defined a total of 44 connectors, one per Kafka topic (one partition per topic). Those topic are produced by Debezium / Postgresql. There are 3 Kafka nodes. Each connector has tasks.max set to 4. Most of my connector (but not every!) has one (always one) failed task, due to java.lang.IllegalStateException: No current assignment for partition -0.</p>
  
  <p>Not a Kafka expert here, note it ;) I'm presuming that there are 3 Kafka nodes, so 3 workers are doing great, and 4th tasks has nothing to connect to so it fails. But why sometimes there are 4 tasks running just fine?</p>
  
  <p>Also, I have quite often "Conflicting operation due to rebalancing" issue, which can occur for minutes, even hours. Recently I've deleted all pods and they restarted themselves, the problem disappeared, but that's not long term solution.</p>
  
  <p>What's the tasks.max recommended value? Thanks in advance!</p>
  
  <p>Exception:</p>
  
  <pre><code>java.lang.IllegalStateException: No current assignment for partition table-0
      at org.apache.kafka.clients.consumer.internals.SubscriptionState.assignedState(SubscriptionState.java:259)
      at org.apache.kafka.clients.consumer.internals.SubscriptionState.seek(SubscriptionState.java:264)
      at org.apache.kafka.clients.consumer.KafkaConsumer.seek(KafkaConsumer.java:1501)
      at org.apache.kafka.connect.runtime.WorkerSinkTask.rewind(WorkerSinkTask.java:601)
      at org.apache.kafka.connect.runtime.WorkerSinkTask.access$1200(WorkerSinkTask.java:70)
      at org.apache.kafka.connect.runtime.WorkerSinkTask$HandleRebalance.onPartitionsAssigned(WorkerSinkTask.java:675)
      at org.apache.kafka.clients.consumer.internals.ConsumerCoordinator.onJoinComplete(ConsumerCoordinator.java:291)
      at org.apache.kafka.clients.consumer.internals.AbstractCoordinator.joinGroupIfNeeded(AbstractCoordinator.java:406)
      at org.apache.kafka.clients.consumer.internals.AbstractCoordinator.ensureActiveGroup(AbstractCoordinator.java:340)
      at org.apache.kafka.clients.consumer.internals.ConsumerCoordinator.poll(ConsumerCoordinator.java:341)
      at org.apache.kafka.clients.consumer.KafkaConsumer.updateAssignmentMetadataIfNeeded(KafkaConsumer.java:1214)
      at org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:1179)
      at org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:1164)
      at org.apache.kafka.connect.runtime.WorkerSinkTask.pollConsumer(WorkerSinkTask.java:445)
      at org.apache.kafka.connect.runtime.WorkerSinkTask.poll(WorkerSinkTask.java:318)
      at org.apache.kafka.connect.runtime.WorkerSinkTask.iteration(WorkerSinkTask.java:226)
      at org.apache.kafka.connect.runtime.WorkerSinkTask.execute(WorkerSinkTask.java:194)
      at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:175)
      at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:219)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748
  </code></pre>
  
  <p>Sink Connector config:</p>
  
  <pre><code>connector.class com.wepay.kafka.connect.bigquery.BigQuerySinkConnector
  autoUpdateSchemas   true
  sanitizeTopics  true
  autoCreateTables    true
  topics  &lt;topic-name&gt;
  tasks.max   3
  schemaRegistryLocation  http://&lt;ip&gt;:8081
  project &lt;big-query-project&gt;
  maxWriteSize    10000
  datasets    .*=&lt;big-query-dataset&gt;
  task.class  com.wepay.kafka.connect.bigquery.BigQuerySinkTask
  keyfile /credentials/&lt;credentials-file&gt;.json
  name    &lt;connector-name&gt;
  schemaRetriever com.wepay.kafka.connect.bigquery.schemaregistry.schemaretriever.SchemaRegistrySchemaRetriever
  tableWriteWait  1000
  bufferSize  100000
  </code></pre>
  
  <p>And it throws above exception <code>java.lang.IllegalStateException: No current assignment for [...]</code></p>