Skip to content

Commit e93290b

Browse files
committed
document COULD_NOT_FIND_EXECUTOR
1 parent eeab6bd commit e93290b

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

docs/troubleshooting.mdx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,36 @@ The most common situation this happens is if you're using `Promise.all` around s
171171

172172
Make sure that you always use `await` when you call `trigger`, `triggerAndWait`, `batchTrigger`, and `batchTriggerAndWait`. If you don't then it's likely the task(s) won't be triggered because the calling function process can be terminated before the networks calls are sent.
173173

174+
### `COULD_NOT_FIND_EXECUTOR`
175+
176+
If you see a `COULD_NOT_FIND_EXECUTOR` error when triggering a task via `batchTrigger` or `batchTriggerAndWait`, it may be caused by dynamically importing the child task. When tasks are dynamically imported, the executor may not be properly registered.
177+
178+
Use a top-level import instead:
179+
180+
```ts
181+
import { myChildTask } from "~/trigger/my-child-task";
182+
183+
export const myTask = task({
184+
id: "my-task",
185+
run: async (payload: string) => {
186+
await myChildTask.batchTrigger([{ payload: "data" }]);
187+
},
188+
});
189+
```
190+
191+
Alternatively, use `batch.triggerAndWait()` without importing the task:
192+
193+
```ts
194+
import { batch } from "@trigger.dev/sdk";
195+
196+
export const myTask = task({
197+
id: "my-task",
198+
run: async (payload: string) => {
199+
await batch.triggerAndWait([{ id: "my-child-task", payload: "data" }]);
200+
},
201+
});
202+
```
203+
174204
### Rate limit exceeded
175205

176206
<RateLimitHitUseBatchTrigger />

0 commit comments

Comments
 (0)