conduktor.io ↗

Kafka Exception IllegalWorkerStateException

org.apache.kafka.connect.errors.IllegalWorkerStateException
Non-retriable Connect

Indicates that a method has been invoked illegally or at an invalid time by a connector or task.

Common Causes

Solutions

Example Stack Trace

org.apache.kafka.connect.errors.IllegalWorkerStateException: SinkTaskContext may not be used to look up partition assignment until the task is initialized at org.apache.kafka.connect.runtime.WorkerSinkTaskContext.assignment(WorkerSinkTaskContext.java:126) at com.example.connect.MySinkTask.start(MySinkTask.java:58) at org.apache.kafka.connect.runtime.WorkerSinkTask.initializeAndStart(WorkerSinkTask.java:309) at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:185) at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:240)

Diagnostic Commands

curl -s http://localhost:8083/connectors/<name>/status | jq '.tasks[] | {id, state, trace}' # FAILED task trace points at the offending context call

Related

Related Connect exceptions: AlreadyExistsException · ConnectException · DataException · NotFoundException · SchemaBuilderException · SchemaProjectorException

Hitting IllegalWorkerStateException in production? Conduktor Console gives you real-time visibility into clients, consumer groups, and broker health. Browse every Kafka exception or protocol error code.