Roadblock: the AI step returned an empty string at 2 a.m. and your workflow happily emailed a blank message to a client. Validate the output and stop the run instead.
// Zapier/Make code step — gate AI output before it reaches a human
const text = (inputData.aiOutput || "").trim();
const refusals = ["as an ai", "i cannot", "i'm sorry"];
if (text.length < 20) {
throw new Error("AI output too short — halting run");
}
if (refusals.some((r) => text.toLowerCase().startsWith(r))) {
throw new Error("AI refused the task — halting run");
}
output = { text };