e2b-dev / e2b-dev/runtime

fix(orchestrator): generic 'build was cancelled' error hides actual failure cause

Open
#3,160 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
1.6k
Forks
438
PR merge metrics
No merged PRs in 30d

Description

Problem

When a template build is cancelled or times out, the orchestrator returns only a generic build was cancelled message. This hides the actual failure cause (e.g., envd crash, provisioning failure) and makes debugging very difficult for users.

Root Cause

In builderrors.WrapContextAsUserError(), any context.Canceled or context.DeadlineExceeded error is replaced with a bare ErrCanceled / ErrTimedOut, discarding the entire error chain that contains diagnostic information.

Example

When envd crashes during a build, the actual error chain is:

wait for envd: failed to init new envd: failed to init envd: context canceled

But the user only sees:

build was cancelled

Proposed Fix

Three targeted changes (+53/-9 lines):

  1. PhaseBuildError.Error() — include phase/step context in the error message
  2. phases.Run() — wrap context cancellation errors with the active phase metadata
  3. WrapContextAsUserError() — preserve the original error chain instead of replacing it
Before / After
Scenario Before After
Cancel during phases.Run build was cancelled context canceled (phase: provision, step: 1)
envd crash build was cancelled build was cancelled: wait for envd: failed to init new envd: context canceled
User cancel build was cancelled build was cancelled: context canceled
Build timeout build timed out build timed out: context deadline exceeded

Fully backward compatible — errors.Is(err, ErrCanceled) still works.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading builderrors.WrapContextAsUserError(), PhaseBuildError.Error(), and phases.Run(), which are the entry points named in the issue. Trace how cancellation and timeout errors move through these functions, then verify that phase and step context plus the underlying error chain appear in messages while errors.Is(err, ErrCanceled) remains compatible.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.