dagger/dagger · error

tunnel start error: %w

Error message

tunnel start error: %w

What it means

startTunnel wraps any startup failure into the cancellation cause of its detached service context, so waiters see the tunnel startup error when the context is cancelled. It is an error-propagation mechanism: the original rerr is preserved as the context cause.

Source

Thrown at core/service.go:1174

	return len(p), nil
}

func (mwc multiWriteCloser) Close() error {
	var errs error
	for _, wc := range mwc {
		errs = errors.Join(errs, wc.Close())
	}
	return errs
}

func (svc *Service) startTunnel(ctx context.Context, running *RunningService, _ ServiceStartOpts) (rerr error) {
	if running == nil {
		return fmt.Errorf("running service is nil")
	}
	svcCtx, stop := context.WithCancelCause(context.WithoutCancel(ctx))
	defer func() {
		if rerr != nil {
			stop(fmt.Errorf("tunnel start error: %w", rerr))
		}
	}()

	clientMetadata, err := engine.ClientMetadataFromContext(ctx)
	if err != nil {
		return err
	}
	svcCtx = engine.ContextWithClientMetadata(svcCtx, clientMetadata)

	query, err := CurrentQuery(ctx)
	if err != nil {
		return err
	}
	svcs, err := query.Services(ctx)
	if err != nil {
		return fmt.Errorf("failed to get services: %w", err)
	}
	bk, err := query.Engine(ctx)

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Inspect the wrapped rerr to find which tunnel startup step failed
  2. Check the tunnel upstream service's availability and reachability
  3. Retry after fixing the underlying start failure
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at core/service.go:1174 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05). Data as JSON: /api/errors/522fcad7ecb4a645. Report an issue: GitHub.