1 export const metadata = {
2 title: `Handler for action X Not Found Workflow Error`,
3 }
4
5 # {metadata.title}
6
7 The following error may occur in production if you use a `when-then` block in your workflow:
8
9 ```plain
10 custom-workflow:when-then-01JE8Z0M1FXSE2NCK1G04S0RR2:invoke - Handler for action \"when-then-01JE8Z0M1FXSE2NCK1G04S0RR2\" not found...
11 ```
12
13 ## Why this Error Occurred
14
15 This error occurs if the `when-then` block doesn't return a step's result and doesn't have a name specified.
16
17 For example:
18
19 ```ts
20 when(input, (input) => !input.is_active)
21 .then(() => {
22 console.log("not returning anything")
23 })
24 ```
25
26 The above `when-then` block doesn't return a step's result, which causes the error.
27
28 ---
29
30 ## How to Fix it
31
32 You can resolve this error by passing a name as a first parameter of `when`:
33
34 ```ts
35 const result = when(
36 "custom-when-condition",
37 input,
38 (input) => !input.is_active
39 )
40 .then(() => {
41 console.log("not returning anything")
42 })
43 ```
44
45 ---
46
47 ## Additional Resources
48
49 - [When-Then documentation](!docs!/learn/fundamentals/workflows/conditions#specify-name-for-when-then)