Monedula

Markdown

Part VI · Reference

Kafka troubleshooting

InvalidConfigurationException (INVALID_CONFIG)

Kafka error · INVALID_CONFIG · not retriable

org.apache.kafka.common.errors.InvalidConfigurationException

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 playground

The 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 plane

What 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

  1. 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.
  2. 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.
  3. 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.
  4. 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

Sources

All troubleshooting pages