Skip to content
Kafka Is Fun
ClusterKRaft clusters

Invalid cluster.id in: /var/lib/kafka/data/meta.properties. Expected abc123, but read xyz789

Checked against Kafka 4.2 · Oct 2026Community draft, not yet reviewed by a Kafka specialist

What it means

Each log directory holds a meta.properties file that records, among other things, the cluster.id and node.id the directory was formatted with. On startup the node compares them with its configuration, and refuses to start if they differ. In the 4.2 source the check throws "Invalid cluster.id in: <path>. Expected <id>, but read <id>", and its documentation says that if a cluster id is set, it must be the same in all directories.

Quick answer

Make every node in the cluster use the same cluster id, and keep each node's data directory with the cluster and node it was formatted for. On a single development machine, formatting a fresh directory is the quickest fix, and it starts that node's data from scratch.

Likely causes, most common first

  1. Nodes were formatted with different cluster ids

    How to confirm

    The KRaft documentation says random-uuid generates a cluster id, and that this id must be used when formatting each server in the cluster. Run separately for each node, it gives each one a different id. Compare the cluster.id line in each node's meta.properties.

    confirm
    # inside each node's log.dirs
    cat meta.properties

    Fix

    Generate the id once and format every node with that same id. The quickstart shows the single-node form; the KRaft documentation covers --cluster-id, --standalone, --initial-controllers and --no-initial-controllers for larger clusters.

    fix
    KAFKA_CLUSTER_ID="$(bin/kafka-storage.sh random-uuid)"
    bin/kafka-storage.sh format --standalone -t $KAFKA_CLUSTER_ID -c config/server.properties
  2. A data directory from another node or cluster was reused

    How to confirm

    A moved or copied data directory, or an old log.dirs from an earlier experiment, still holds a meta.properties for different ids. For a node id mismatch the message is "Stored node id ... doesn't match previous node id ... If you moved your data, make sure your configured node id matches."

    Fix

    Use the node id the directory was formatted with, or point the node at a fresh directory. The same message says that if you intend to create a new node, you should remove all data in your data directories.

  3. The directory was never formatted, or was emptied

    How to confirm

    The message is "No readable meta.properties files found." The KRaft documentation says Kafka no longer formats blank storage directories automatically, because that could obscure an error condition. Check where log.dirs points; if it is not set, log.dir is used, whose default is /tmp/kafka-logs.

    Fix

    Point log.dirs (and metadata.log.dir if you set it) at a persistent location, format it once, and keep it.

Sources

Every claim above comes from these Apache pages, as of Kafka 4.2. If a page does not say it, this entry does not.

Back to all errors