dagger/dagger · error

failed to sync sdk moduleTypes container: %w

Error message

failed to sync sdk moduleTypes container: %w

What it means

Wraps a failure of the container `sync` call that actually runs the SDK moduleTypes exec and waits for it to finish. Since withExec was marked hidden (WithSkip), sync is where the SDK codegen process runs and any SDK crash/exit surfaces. The wrapped error contains the exec's exit code or runtime failure.

Source

Thrown at core/sdk/module_typedefs.go:120

			Field: "withExec",
			Args: []dagql.NamedInput{
				{Name: "args", Value: dagql.ArrayInput[dagql.String]{}},
				{Name: "useEntrypoint", Value: dagql.NewBoolean(true)},
				{Name: "experimentalPrivilegedNesting", Value: dagql.NewBoolean(true)},
				{Name: "execMD", Value: dagql.NewDigestedSerializedString(&execMD, moduleTypesExecMDDigest)},
				{Name: "moduleContext", Value: dagql.Opt(moduleContextID)},
			},
		},
	)
	if err != nil {
		return inst, fmt.Errorf("failed to execute sdk moduleTypes container: %w", err)
	}

	var syncedCtrID dagql.ID[*core.Container]
	if err = dag.Select(hideCtx, ctr, &syncedCtrID, dagql.Selector{
		Field: "sync",
	}); err != nil {
		return inst, fmt.Errorf("failed to sync sdk moduleTypes container: %w", err)
	}

	ctr, err = syncedCtrID.Load(ctx, dag)
	if err != nil {
		return inst, fmt.Errorf("failed to load synced sdk moduleTypes container: %w", err)
	}

	var modDefsID string
	err = dag.Select(ctx, ctr, &modDefsID,
		dagql.Selector{
			Field: "file",
			Args: []dagql.NamedInput{
				{
					Name:  "path",
					Value: dagql.NewString(moduleIDPath),
				},
			},
		},

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Inspect the wrapped error / exec logs for the SDK process's stderr and exit code.
  2. Run the SDK's codegen step manually (e.g. dagger develop equivalents) to reproduce.
  3. Ensure the CI runner allows privileged nesting if required.
  4. Check disk/memory limits on the engine.
Defensive patterns

Strategy: retry

Validate before calling

// Check engine resources before long module loads
dagger query --help >/dev/null && echo "engine reachable"

Try / catch

inst, err := ModuleTypes(ctx, ...)
if err != nil && strings.Contains(err.Error(), "failed to sync sdk moduleTypes container") {
    // inspect SDK exec stderr in wrapped error; retry with backoff if transient
}

Prevention

When it happens

Trigger: dag.Select(hideCtx, ctr, ..., Field "sync") fails because the SDK runtime container exits non-zero, the entrypoint fails, or the exec is canceled (context cancellation, engine shutdown).

Common situations: The SDK runtime binary crashes while generating typedefs; OOM or missing dependencies in the SDK image; user cancels the command; privileged nesting fails in restricted CI environments.

Related errors


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