dagger/dagger · error

service exited before healthcheck

Error message

service exited before healthcheck

What it means

In startContainer's select loop the service process exited (exitErr == nil) before any health check completed, so it can never become healthy. Means the container terminated immediately after start — bad command, crash, or immediate exit.

Source

Thrown at core/service.go:1092

				continue
			}
			return stopDueToDependencyExit(depErr)
		case <-exited:
			if exitErr != nil {
				var gwErr *gwpb.ExitError
				if errors.As(exitErr, &gwErr) {
					// Create ExecError with available service information
					return &ExecError{
						Err:      telemetry.TrackOrigin(gwErr, span.SpanContext()),
						Cmd:      meta.Args,
						ExitCode: int(gwErr.ExitCode),
						Stdout:   stdoutBuf.String(),
						Stderr:   stderrBuf.String(),
					}
				}
				return exitErr
			}
			return fmt.Errorf("service exited before healthcheck")
		}
	}
}

func convertResizeChannel(ctx context.Context, in <-chan bkgw.WinSize) <-chan executor.WinSize {
	if in == nil {
		return nil
	}
	out := make(chan executor.WinSize)
	go func() {
		defer close(out)
		for {
			select {
			case <-ctx.Done():
				return
			case winSize := <-in:
				out <- executor.WinSize{
					Rows: winSize.Rows,

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Check the service's command/entrypoint and captured stdout/stderr buffers
  2. Verify the service actually listens and stays alive
  3. Fix the container image or command so the process runs until healthy
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at core/service.go:1092 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/ca38ffb50b01684e. Report an issue: GitHub.