On this page
Kafka troubleshooting
InvalidConfigurationException (INVALID_CONFIG)
org.
Kafka rejected a topic config change with INVALID_CONFIG (error code 40) because a config in the request fails validation: a name that is not a topic config, a value of the wrong type or outside its range, or settings that contradict each other. The topic's configs stay as they were. The message names the config; fix it and send the request again.
Reproduce it in the playground3 steps beforeProducing normally; one Agent is down. t+2.150s
orders is a WarpStream topic (Agent v857). Three Agents ran here, one per zone, but agent-2 in az-b was hard-killed at 50 and is still down; no client sits in az-b. p-a (ws_az=az-a) writes through agent-1 and p-c (ws_az=az-c) through agent-3. Their first records, k1 and k2, were committed by the control plane at 1450 and acked, and g1's consumer c1 in az-a read them at 1800. Their second records, k3 and k4, are in one file on agent-1 and one on agent-3: both uploads ended at 2100, and the commit requests are with the control plane, not yet answered.
Open at this step: step 1, Producing normally; one Agent is down2 steps beforeThe control plane is unreachable: commits fail, files are orphaned. t+2.300s
The control plane stops at 2200, and the Agents notice at once (the simulator's choice). At 2300 both commit requests fail. The files holding k3 and k4 are in object storage, but no commit names them: they are orphans. WarpStream's garbage collection deletes orphans later; the simulator does not model it, so they stay drawn. Neither record was acked, so nothing acked is lost: p-a and p-c each get REQUEST_TIMED_OUT (WarpStream's docs name no code; the simulator's choice) and will retry.
Open at this step: step 2, The control plane is unreachable: commits fail, files are orphaned1 step beforeProduce is rejected; consumers and the group stop. t+2.550s
WarpStream's docs say that without the control plane an Agent rejects produce and fails every request that needs the control plane. At 2550 p-a's k5 and p-c's k6 are rejected at once with REQUEST_TIMED_OUT, and nothing enters an Agent's buffer. At 2400 c1's fetch failed with REQUEST_TIMED_OUT on every partition, because the list of files to read comes from the control plane, and its offset commit failed with COORDINATOR_NOT_AVAILABLE (the simulator's choice of code), because the control plane coordinates the consumer groups. c1 keeps its partitions but reads and commits nothing.
Open at this step: step 3, Produce is rejected; consumers and the group stopThe moment it happensThe dead Agent cannot start without the control plane. t+2.800s
At 2800 agent-2 is restarted, and the restart is refused: WarpStream's docs say an Agent cannot start without the control plane. The refusal carries InvalidConfigurationException, the simulator's choice: it names a Kafka error on every refusal, and nothing is wrong with any config. agent-2 stays down. The producers keep retrying 400 ms after each error (the simulator's retry backoff): k3 and k4 were sent again at 2700 and rejected the same way.
Open at this step: step 4, The dead Agent cannot start without the control planeRight afterThe control plane is back: everything resumes. t+3.850s
The control plane starts at 3400. The next retries go through: k3 and k4 reach agent-1 and agent-3 again at 3500, k5 and k6 at 3750, and the new sends k7 and k8 at 3850. At 3600 c1 commits the offsets it read before the outage and fetches again; nothing new is committed yet. The orphan files stay where they are: their records are written only by these retries. agent-2 is still down, since nothing restarted it after the refusal.
Open at this step: step 5, The control plane is back: everything resumesWhat it means
In Apache Kafka 4.4 the controller validates every topic config change before it writes it to the metadata log. It rejects a name that is not a topic config ("Unknown topic config name") and a value its definition does not accept: that check raises a ConfigException, which the controller returns as INVALID_CONFIG with the exception's message, for example for a cleanup.policy that is neither delete nor compact. It also rejects settings that contradict each other, such as min.compaction.lag.ms above max.compaction.lag.ms, or turning remote storage off on a topic without agreeing to delete the data already in remote storage. A null value is a different error: the broker refuses a set to null before it reaches the controller, with INVALID_REQUEST. Broker-level changes go through the same controller with rules of their own; for example, the broker-level min.insync.replicas cannot be altered while Eligible Leader Replicas are enabled. The admin client sees the exception as the cause of the ExecutionException its request's future fails with, and kafka-configs.sh or kafka-topics.sh print its message. The simulator also uses InvalidConfigurationException for one refusal that is not a Kafka request at all: on a WarpStream cluster, restarting an Agent while the control plane is unreachable. WarpStream's docs say an Agent cannot start without the control plane and name no error, since the Agent is a process that fails to start rather than a client request, so the error name is the simulator's choice: it names a Kafka error on every refusal and reuses this one, although nothing is wrong with any config. Scenario 10.1.4 shows it.
Likely causes, most common first
- A misspelled or unknown config name. The name is not a topic config: a typo such as retention.time for retention.ms, or a producer or broker setting such as linger.ms put on a topic. The controller refuses the whole change and names the unknown config.
- A value the config does not accept. The value has the wrong type or is outside the valid range: retention.ms=7d instead of a number of milliseconds, cleanup.policy=deleted, or min.insync.replicas=0. The message gives the value and what the config accepts.
- Settings that contradict each other. Some configs are checked together: min.compaction.lag.ms must not exceed max.compaction.lag.ms; turning remote.storage.enable off needs remote.log.delete.on.disable=true (to keep the remote data, leave it on and set remote.log.copy.disable=true instead); and with remote.log.copy.disable=true, local.retention.ms and retention.ms (and the two byte limits) must be equal.
- WarpStream in the simulator: an Agent restarted while the control plane is down. On a WarpStream cluster in the simulator, a restart of an Agent, or a new Agent, is refused while the control plane is unreachable, and the refusal carries InvalidConfigurationException, because the simulator names a Kafka error on every refusal and reuses this one. Nothing is wrong with any config: the Agent cannot start until the control plane is back.
How to fix it
- Read the message: it names the config and, for a bad value, what the config accepts.
- Check the name against the topic configs in the Kafka docs for your version; a setting for a producer, a consumer or a broker belongs in that client's or broker's config instead.
- Check the value's type, unit and valid values in the same docs, and change related settings together in one request when they are checked against each other.
- Remove a topic config with kafka-configs.sh --delete-config, or an incremental alter of type DELETE, instead of sending an empty or null value.
- In the simulator, on WarpStream, start the control plane first, then restart the Agent.
What not to do
- Retrying the same request in a loop: the error is not retriable, and the request fails the same way until the config in it changes.
Does the client retry it?
No. INVALID_CONFIG (error code 40) is not retriable: InvalidConfigurationException extends ApiException, not RetriableException, and the same request gets the same answer every time. Fix the config in the request, then send it again.
Reproduce it in the simulator
- WarpStream Kafka: the control plane goes down (WarpStream: the control plane is unreachable) Open at the moment it happens: WarpStream Kafka: the control plane goes down
Sources
- Apache Kafka 4.4 javadoc: InvalidConfigurationException
- Apache Kafka 4.4.0 source: Errors.java (INVALID_CONFIG, code 40)
- Apache Kafka 4.4.0 source: LogConfig.java (unknown names, conflicting topic configs)
- Apache Kafka 4.4.0 source: ConfigAdminManager.scala (a null value is INVALID_REQUEST)
- Apache Kafka 4.4.0 source: ConfigurationControlManager.java (a ConfigException returns INVALID_CONFIG)
- Apache Kafka 4.4: topic configs
- WarpStream docs: Ripcord (an Agent cannot start without the control plane)