Skip to content

bug fix: pipe/branch operators re-invoke on error instead of propagating it#650

Merged
henri-hulski merged 1 commit intocerebral:nextfrom
ericsorenson:next
Mar 17, 2026
Merged

bug fix: pipe/branch operators re-invoke on error instead of propagating it#650
henri-hulski merged 1 commit intocerebral:nextfrom
ericsorenson:next

Conversation

@ericsorenson
Copy link
Copy Markdown
Collaborator

The bug was in packages/overmind/src/operators.ts in both pipe (line 105) and branch (line 217). The catch blocks were re-invoking the same operator that just
threw:

// Before (bug): re-invokes the throwing operator → infinite recursion
catch (operatorError) {
operatorToRun(operatorErr, operatorContext, run, final)
}

// After (fix): propagates the error to the next operator in the chain
catch (operatorError) {
run(operatorError, operatorContext)
}

By calling run(operatorError, operatorContext), the error is passed forward through the operator chain where it can be handled by catchError or tryCatch —
matching how createOperator and createMutationOperator already handle errors internally.

…agating it

he bug was in packages/overmind/src/operators.ts in both pipe (line 105) and branch (line 217). The catch blocks were re-invoking the same operator that just
  threw:

  // Before (bug): re-invokes the throwing operator → infinite recursion
  catch (operatorError) {
    operatorToRun(operatorErr, operatorContext, run, final)
  }

  // After (fix): propagates the error to the next operator in the chain
  catch (operatorError) {
    run(operatorError, operatorContext)
  }

  By calling run(operatorError, operatorContext), the error is passed forward through the operator chain where it can be handled by catchError or tryCatch —
  matching how createOperator and createMutationOperator already handle errors internally.
@codesandbox
Copy link
Copy Markdown

codesandbox Bot commented Mar 17, 2026

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@henri-hulski henri-hulski merged commit bf33b8e into cerebral:next Mar 17, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants