pitcheye.dev← All 30 rules
severity: errorpack: inngestv1.0 core

inngest/non-deterministic-outside-step

Side effect runs outside `step.run()`

npx @pitcheye/check . --pack inngest

whyItBreaks

Inngest replays the handler from the first line on every step transition and on every retry. A database write or an API call outside `step.run()` is repeated each time: duplicate notifications, double charges, one email per replay. It is invisible in the first run because the first run looks correct.

✖ Bad — triggers errorfixtures/inngest-non-deterministic-outside-step/bad
async ({ event, step }) => {
  await getDb().insert(notifications).values({ userId: event.data.userId });
}
✓ Good — passes checkfixtures/inngest-non-deterministic-outside-step/good
async ({ event, step }) => {
  await step.run("record-notification", async () => {
    await getDb().insert(notifications).values({ userId: event.data.userId });
  });
}

suggestedFix

Wrap every side effect in `await step.run("name", async () => { … })` and return the value you need. Keep only pure computation in the function body.

explain_rule({"inngest/non-deterministic-outside-step"})

Agent & MCP JSON output contract

{
  "ruleId": "inngest/non-deterministic-outside-step",
  "pack": "inngest",
  "severity": "error",
  "file": "apps/web/src/inngest/functions.ts",
  "line": 6,
  "message": "a DB/HTTP/SDK call in a function body with no `step.run()` ancestor",
  "whyItBreaks": "Inngest replays the handler from the first line on every step transition and on every retry. A database write or an API call outside `step.run()` is repeated each time: duplicate notifications, double charges, one email per replay. It is invisible in the first run because the first run looks correct.",
  "suggestedFix": "Wrap every side effect in `await step.run(\"name\", async () => { … })` and return the value you need. Keep only pure computation in the function body.",
  "docsUrl": "https://pitcheye.dev/rules/inngest-non-deterministic-outside-step"
}

Markdown: curl -H "Accept: text/markdown" https://pitcheye.dev/rules/inngest-non-deterministic-outside-step

raw markdown
# inngest/non-deterministic-outside-step

- **severity:** error
- **pack:** inngest
- **docs:** https://pitcheye.dev/rules/inngest-non-deterministic-outside-step

## whyItBreaks

Inngest replays the handler from the first line on every step transition and on every retry. A database write or an API call outside `step.run()` is repeated each time: duplicate notifications, double charges, one email per replay. It is invisible in the first run because the first run looks correct.

## bad

```ts
async ({ event, step }) => {
  await getDb().insert(notifications).values({ userId: event.data.userId });
}
```

## good

```ts
async ({ event, step }) => {
  await step.run("record-notification", async () => {
    await getDb().insert(notifications).values({ userId: event.data.userId });
  });
}
```

## suggestedFix

Wrap every side effect in `await step.run("name", async () => { … })` and return the value you need. Keep only pure computation in the function body.

## commands

```bash
npx @pitcheye/check . --pack inngest
```

```json
{"tool":"explain_rule","arguments":{"ruleId":"inngest/non-deterministic-outside-step"}}
```
Back to rule cataloginngest/nested-step-run →