dagger/dagger · error

failed to get Dagger server: %w

Error message

failed to get Dagger server: %w

What it means

Fires in containerUp when the ctx carries no Dagger server. The up flow re-selects 'asService' through the current server to apply the caller's view; without a server in the context the service cannot be materialized. Indicates the API was invoked outside a normal call context.

Source

Thrown at core/schema/service.go:310

		expandedArg, err := expandEnvVar(ctx, parent.Self(), arg, args.Expand)
		if err != nil {
			return nil, err
		}

		expandedArgs[i] = expandedArg
	}
	args.Args = expandedArgs

	return parent.Self().AsService(ctx, parent, args)
}

func (s *serviceSchema) containerUp(ctx context.Context, ctr dagql.ObjectResult[*core.Container], args struct {
	UpArgs
	core.ContainerAsServiceArgs
}) (res dagql.Nullable[core.Void], _ error) {
	srv, err := core.CurrentDagqlServer(ctx)
	if err != nil {
		return res, fmt.Errorf("failed to get Dagger server: %w", err)
	}

	var inputs []dagql.NamedInput
	if args.Args != nil {
		inputs = append(inputs, dagql.NamedInput{
			Name:  "args",
			Value: dagql.ArrayInput[dagql.String](dagql.NewStringArray(args.Args...)),
		})
	}
	if args.UseEntrypoint {
		inputs = append(inputs, dagql.NamedInput{
			Name:  "useEntrypoint",
			Value: dagql.Boolean(true),
		})
	}
	if args.ExperimentalPrivilegedNesting {
		inputs = append(inputs, dagql.NamedInput{
			Name:  "experimentalPrivilegedNesting",

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Check the wrapped error for the context/server state problem
  2. Retry the up call; report if it persists
Defensive patterns

Strategy: try-catch

When it happens

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