AutomationIntermediate

How to Debug AI Steps in Zapier Using Zap History

Find out why an AI step returned the wrong answer or broke a later action by reading the run logs and reproducing it.

7 minIntermediate

AI steps fail in their own ways: empty output, extra commentary that breaks a JSON parser, or a label that no longer matches a Paths rule. Zapier's Zap History shows the exact input and output of every run, which is almost always enough to find the cause. This guide is your debugging routine.

What you need

  • A live Zap with an AI step that is misbehaving
  • Access to Zap History (in the left sidebar)
  • About 10 minutes

Step 1: Open the failed run

Go to Zap History and find the run that went wrong. Click it to expand every step. Each step shows Data In and Data Out, so you can trace the exact values that flowed through the Zap on that run.

Zapier - Zap History
Run at 09:14 status: Stopped
1 Trigger Gmail ok
2 AI step Analyze data ok
3 Formatter Import JSON ERROR
Could not parse input as JSON
4 Sheets Create row skipped
Each run lists per-step status with input and output.

Step 2: Inspect the AI Data Out

Open the AI step and read its Data Out exactly as returned. The usual culprit is the model wrapping JSON in prose or a code fence, which a parser then rejects. Seeing the raw text tells you precisely what to fix.

AI Data Out (the bug)
Sure! Here is the JSON you asked for:

```json
{ "name": "Dana", "total": 148.5 }
```
The prose is the problem
The Import JSON step received the friendly sentence and the code fence, not pure JSON, so it failed. The model ignored part of the instruction. Tighten the prompt rather than blaming the parser.

Step 3: Fix the prompt and re-test

Edit the AI step prompt to forbid extra text explicitly, and lower the temperature if you control it. Then use the editor's Test button to run the step again with the same sample and confirm the output is now clean.

Hardened prompt
Reply with raw JSON only. No prose. No code fences.
No leading or trailing characters. Start with { and
end with }.

{ "name": string, "total": number }

Step 4: Replay the run

Back in Zap History you can often use Replay on the failed run to re-send the same data through the fixed Zap. This confirms the fix works on the exact case that broke, without waiting for a new live event.

Add a guard step
After the AI step, add a Formatter or Filter that strips code fences and checks the text starts with a brace. A small guard makes the whole Zap resilient to the occasional chatty response.

Result: You can pinpoint why any AI step misbehaved by reading its real input and output, fix the prompt, replay the exact failure, and confirm the Zap now runs clean end to end.

Watch related tutorials

Tags
#zapier#ai#debugging#troubleshooting#logs