# DLQ Triage Assistant

> Guided DLQ troubleshooting for Kafka Connect/Debezium: list DLQ messages, inspect headers, decode payloads, and map errors to fixes.

Canonical page: <https://sandgraal.github.io/letstalkcdc/dlq-triage/>

Point this at your DLQ topic and connector name. Generate safe commands to inspect headers, unwrap payloads, and map errors to fixes.

Start Debugging

[← Back to Overview](https://sandgraal.github.io/letstalkcdc/overview/#series-dlq-triage)

## 1) inputs

bootstrap: dlq topic:

connector name: consumer group (sink):

## 2) enumerate & peek

```
# count a sample & show latest offsets
kafka-run-class kafka.tools.GetOffsetShell \
  --broker-list localhost:9092 --topic dlq.inventory --time -1

# peek a few DLQ records (value only)
kafka-console-consumer --bootstrap-server localhost:9092 \
  --topic dlq.inventory --from-beginning --timeout-ms 4000 \
  --max-messages 5 | jq -C .
```

**show headers & decode original value**

```
# show headers (kafka cli shows headers only with Kafkacat or kcat)
# try kcat if available (brew install kcat)
kcat -b localhost:9092 -t dlq.inventory -C -J -c 5 | jq -C .

# extract original payload if record is wrapped (common in Connect DLQs)
kafka-console-consumer --bootstrap-server localhost:9092 \
  --topic dlq.inventory --from-beginning --timeout-ms 4000 --max-messages 5 \
  | jq -r '.original.value // .record.value // .value // .payload.original.value // .payload.record.value // empty' \
  | jq -C .
```

**connector status & restart**

```
curl -s http://localhost:8083/connectors | jq
curl -s http://localhost:8083/connectors/inventory-connector/status | jq
# restart connector (use sparingly)
curl -s -X POST http://localhost:8083/connectors/inventory-connector/restart
```

**sink lag (is the consumer stuck?)**

```
kafka-consumer-groups --bootstrap-server localhost:9092 \
  --describe --group my-sink
```

> ## common DLQ causes → fixes
>
> java.sql.SQLException
>
> sink rejected a row (PK/unique violation, type mismatch). ➜ check target PK & datatypes; use [merge/upsert](https://sandgraal.github.io/letstalkcdc/merge-cookbook/) patterns.
>
> org.apache.kafka.common.errors.SerializationException
>
> value/headers not parseable (schema mismatch). ➜ align converters (schemas.enable), topic routing, or use schema registry where required.
>
> org.apache.kafka.connect.errors.ConnectException
>
> connector task error; check Connect logs; the DLQ record will carry context in headers.
>
> key not set / null key
>
> sink requires a key but topic lacks one. ➜ set proper key.converter/key.field or route to a history table, then collapse by key at sink.
>
> ## decode a DLQ record locally
>
> paste a DLQ JSON line below and we’ll unwrap the original event. nothing is uploaded.
>
> [open full decoder →](https://sandgraal.github.io/letstalkcdc/debezium-decoder/)
>
> ## safe re-drive (optional)
>
> once the root cause is fixed, re-drive a few DLQ records into a *sandbox* topic first.
>
> ```
> # re-drive DLQ values into a sandbox topic (no headers preserved)
> kafka-console-consumer --bootstrap-server localhost:9092 \
>   --topic dlq.inventory --from-beginning --max-messages 100 \
>   | jq -r '.original.value // .record.value // .value // .payload.original.value // .payload.record.value // empty' \
>   | kafka-console-producer --bootstrap-server localhost:9092 --topic sandbox.replay
> ```
>
> verify sink behavior on `sandbox.replay` before touching the original topic.

---

CDC: The Missing Manual by Christopher Ennis (Let's Talk CDC), licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Attribution is required.
