---
title: "InvalidConfigurationException in Kafka: INVALID_CONFIG"
description: "Why Kafka rejects a topic config change with INVALID_CONFIG: an unknown config name, a value the config does not accept, or settings that contradict each other."
url: https://monedula.dev/kafka/troubleshooting/invalid-configuration-exception/
---

# InvalidConfigurationException (INVALID_CONFIG)

Kafka error · INVALID_CONFIG · not retriable.

Exception: `org.apache.kafka.common.errors.InvalidConfigurationException`

## Quick answer

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.

## 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

- [WarpStream Kafka: the control plane goes down](https://monedula.dev/kafka-simulator/scenarios/warpstream-control-plane-down/) (WarpStream: the control plane is unreachable): [open at the moment it happens](https://monedula.dev/kafka-simulator/playground/?scenario=10.1.4&t=3)

## Sources

- [Apache Kafka 4.4 javadoc: InvalidConfigurationException](https://kafka.apache.org/44/javadoc/org/apache/kafka/common/errors/InvalidConfigurationException.html)
- [Apache Kafka 4.4.0 source: Errors.java (INVALID_CONFIG, code 40)](https://github.com/apache/kafka/blob/4.4.0/clients/src/main/java/org/apache/kafka/common/protocol/Errors.java)
- [Apache Kafka 4.4.0 source: LogConfig.java (unknown names, conflicting topic configs)](https://github.com/apache/kafka/blob/4.4.0/storage/src/main/java/org/apache/kafka/storage/internals/log/LogConfig.java)
- [Apache Kafka 4.4.0 source: ConfigAdminManager.scala (a null value is INVALID_REQUEST)](https://github.com/apache/kafka/blob/4.4.0/core/src/main/scala/kafka/server/ConfigAdminManager.scala)
- [Apache Kafka 4.4.0 source: ConfigurationControlManager.java (a ConfigException returns INVALID_CONFIG)](https://github.com/apache/kafka/blob/4.4.0/metadata/src/main/java/org/apache/kafka/controller/ConfigurationControlManager.java)
- [Apache Kafka 4.4: topic configs](https://kafka.apache.org/44/configuration/topic-configs/)
- [WarpStream docs: Ripcord (an Agent cannot start without the control plane)](https://docs.warpstream.com/warpstream/kafka/advanced-agent-deployment-options/ripcord)

## Related

- [TimeoutException in Kafka producers: causes and fixes](https://monedula.dev/kafka/troubleshooting/producer-timeout-exception/)
- [COORDINATOR_NOT_AVAILABLE in Kafka: causes and fixes](https://monedula.dev/kafka/troubleshooting/coordinator-not-available/)
