severity: errorpack: inngestv1.0 core
inngest/nested-step-run
`step.run()` nested inside another `step.run()`
npx @pitcheye/check . --pack inngestwhyItBreaks
Steps are journaled by id at the top level of the function. A nested step is never independently memoised, so it re-executes with its parent on every replay while its own id is skipped — the work runs a different number of times than the journal says, which is how "exactly once" quietly becomes "sometimes zero".
✖ Bad — triggers errorfixtures/inngest-nested-step-run/bad
await step.run('outer', async () => {
await step.run('inner', async () => 1);
});✓ Good — passes checkfixtures/inngest-nested-step-run/good
const inner = await step.run('inner', async () => 1);
await step.run('outer', async () => inner);suggestedFix
Flatten it: await the inner step into a variable at the function level and pass the value into the outer one.
explain_rule({"inngest/nested-step-run"})Agent & MCP JSON output contract
{
"ruleId": "inngest/nested-step-run",
"pack": "inngest",
"severity": "error",
"file": "apps/web/src/inngest/functions.ts",
"line": 6,
"message": "a `step.run(` call with another `step.run(` in its ancestors",
"whyItBreaks": "Steps are journaled by id at the top level of the function. A nested step is never independently memoised, so it re-executes with its parent on every replay while its own id is skipped — the work runs a different number of times than the journal says, which is how \"exactly once\" quietly becomes \"sometimes zero\".",
"suggestedFix": "Flatten it: await the inner step into a variable at the function level and pass the value into the outer one.",
"docsUrl": "https://pitcheye.dev/rules/inngest-nested-step-run"
}Markdown: curl -H "Accept: text/markdown" https://pitcheye.dev/rules/inngest-nested-step-run
raw markdown
# inngest/nested-step-run
- **severity:** error
- **pack:** inngest
- **docs:** https://pitcheye.dev/rules/inngest-nested-step-run
## whyItBreaks
Steps are journaled by id at the top level of the function. A nested step is never independently memoised, so it re-executes with its parent on every replay while its own id is skipped — the work runs a different number of times than the journal says, which is how "exactly once" quietly becomes "sometimes zero".
## bad
```ts
await step.run('outer', async () => {
await step.run('inner', async () => 1);
});
```
## good
```ts
const inner = await step.run('inner', async () => 1);
await step.run('outer', async () => inner);
```
## suggestedFix
Flatten it: await the inner step into a variable at the function level and pass the value into the outer one.
## commands
```bash
npx @pitcheye/check . --pack inngest
```
```json
{"tool":"explain_rule","arguments":{"ruleId":"inngest/nested-step-run"}}
```