dagger/dagger · error

clone exec rootfs: %w

Error message

clone exec rootfs: %w

What it means

Wraps a failure from CloneContainerDirectoryAccessor while ContainerRuntime.Call prepares a function-exec container (core/sdk.go:256). Before running module code, Dagger clones the runtime container's rootfs accessor so the exec doesn't mutate the original; failure means the rootfs Directory could not be cloned (underlying blob/copy error surfaced via %w).

Source

Thrown at core/sdk.go:256

	Container dagql.ObjectResult[*Container]
}

func (r *ContainerRuntime) AsContainer() (dagql.ObjectResult[*Container], bool) {
	return r.Container, true
}

func (r *ContainerRuntime) Call(
	ctx context.Context,
	execMD *engineutil.ExecutionMetadata,
	fnCall *FunctionCall,
	moduleContext dagql.ObjectResult[*Module],
) error {
	hideCtx := dagql.WithSkip(ctx)

	ctr := r.Container
	clonedFS, err := CloneContainerDirectoryAccessor(hideCtx, ctr.Self().FS)
	if err != nil {
		return fmt.Errorf("clone exec rootfs: %w", err)
	}
	clonedMounts, err := CloneContainerMounts(hideCtx, ctr.Self().Mounts)
	if err != nil {
		return fmt.Errorf("clone exec mounts: %w", err)
	}
	clonedMeta, err := CloneContainerMetaSnapshot(hideCtx, ctr.Self().MetaSnapshot)
	if err != nil {
		return fmt.Errorf("clone exec meta snapshot: %w", err)
	}
	execCtr := &Container{
		FS:                 clonedFS,
		MetaSnapshot:       clonedMeta,
		Config:             ctr.Self().Config,
		EnabledGPUs:        slices.Clone(ctr.Self().EnabledGPUs),
		Mounts:             clonedMounts,
		Platform:           ctr.Self().Platform,
		Annotations:        slices.Clone(ctr.Self().Annotations),
		Secrets:            slices.Clone(ctr.Self().Secrets),

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Inspect the wrapped cause (%w) and fix the underlying storage error (free disk, repair content store)
  2. Retry the operation — transient cache/blob errors often resolve on rerun
  3. Rebuild the runtime container (re-pull image / recreate filesystem steps) to refresh the rootfs reference
  4. As a last resort, clear the engine content cache and re-run (dagger engine prune / restart engine)

Example fix

// before
ctr := dag.Container().From("alpine") // image pull was interrupted
// after
ctr := dag.Container().From("alpine") // re-pull fully, then retry the function call
dag.Container().From("alpine").Sync(ctx) // warm the cache first
Defensive patterns

Strategy: retry

Validate before calling

// verify the rootfs is loadable before the call
if _, err := ctr.Rootfs().Sync(ctx); err != nil {
    // rebuild the container first
}

Try / catch

err := runtime.Call(ctx, execMD, fnCall, modCtx)
if err != nil && strings.Contains(err.Error(), "clone exec rootfs") {
    // check disk space / prune cache, then retry
}

Prevention

When it happens

Trigger: Calling a module function (constructor or function) whose runtime container's FS cannot be cloned — typically an underlying storage/cache read error on the rootfs blobs, or a corrupted/evicted rootfs reference.

Common situations: Corrupted engine cache after a crash or disk-full; container built from an image layer that failed to load; running with an engine whose content store was partially deleted.

Related errors


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