# org.apache.kafka.common.errors.InvalidPartitionCountException: Number of partitions must be greater than 0.

- **ID:** `kafka/invalid-partition-count`
- **Domain:** kafka
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 95%

## Root Cause

An attempt was made to create or alter a topic with a partition count of zero or negative, which is not allowed.

## Workarounds

1. **Ensure partition count is a positive integer. Example fix: `kafka-topics.sh --bootstrap-server localhost:9092 --alter --topic my_topic --partitions 3` (never 0).** (95% success)
   ```
   Ensure partition count is a positive integer. Example fix: `kafka-topics.sh --bootstrap-server localhost:9092 --alter --topic my_topic --partitions 3` (never 0).
   ```

## Dead Ends

- **** — Setting partitions to 1 in a script that mistakenly passes 0 (e.g., from a default config) still fails; the fix is to validate input before the API call. (70% fail)
- **** — Using a negative value from a bug in partition calculation code (e.g., integer overflow) will still be rejected; the code must be fixed. (90% fail)
