@tim753milner You’re encountering the following error from your Zeebe 8.6.18 cluster:
PartitionNotFoundException: Expected to execute command on partition -1, but either it does not exist, or the gateway is not yet aware of it
This error means that the Zeebe gateway received a request for partition -1
, which is invalid, and thus can’t route the command to a broker.
Root Cause: -1
Partition ID
In Zeebe, partition IDs are always >= 1, and -1
is not a valid partition. This typically happens due to one of these reasons:
1. Invalid or Missing Partition Routing in Client
When you use the Zeebe client (via Spring Boot or direct SDK), it should route a command to a specific partition based on the BPMN process ID or process instance key.
But if:
- The process ID doesn’t exist
- The process wasn’t deployed properly
- The process instance key is invalid
- You’re making an operation like resolveIncident without a valid target
…then Zeebe client may attempt to resolve routing and ends up with partitionId -1
, which leads to this error.
2. Client and Gateway Version Mismatch
You’re using:
- Zeebe Cluster 8.6.18
- Client SDK: 8.5.0 (older)
This mismatch can lead to deserialization or API handling issues where partition routing isn’t correctly resolved.
Recommended Solutions
1. Upgrade Client SDK to Match Zeebe Version
Upgrade your Spring Boot Zeebe SDK to match Zeebe version 8.6.18:
In your pom.xml
:
<dependency>
<groupId>io.camunda</groupId>
<artifactId>spring-boot-starter-camunda</artifactId>
<version>8.6.0</version> <!-- or the latest patch of 8.6.x -->
</dependency>
- The Spring client must match the broker/gateway version to ensure proper behavior.
2. Verify You’re Sending a Valid Command
If this is triggered by resolveIncident(incidentKey)
, ensure:
- The
incidentKey
you’re using is a real, active incident key.
- The key hasn’t been already resolved or expired.
- You’re not calling it with an invalid or default value like
-1L
.
Example (Java):
zeebeClient.newResolveIncidentCommand(incidentKey)
.send()
.join();
Make sure incidentKey > 0
.
3. Verify Process Deployment & Partition Count
Check that:
- Your process is deployed
- Your Zeebe brokers are aware of it
- Partition count is correct (default: 1, in production often 3+)
Use Operate or Zeebe client to check if the process exists and is distributed across partitions.
4. Restart Gateway to Reconnect to Brokers
If the gateway has lost awareness of partitions (especially during broker startup/shutdown), restarting it may help.
kubectl rollout restart deployment zeebe-gateway
To debug further
Enable debug logging for Zeebe client and gateway:
logging:
level:
io.camunda.zeebe: DEBUG