dagger/dagger · error

failed to content hash dockerfile bind mount: source snapsho

Error message

failed to content hash dockerfile bind mount: source snapshot: %w

What it means

Dockerfile bind-mount cache-key computation failed to obtain the source directory's snapshot (GetOrEval on the mounted dir). This is an internal evaluation error while materializing the mount context for content hashing — the source directory could not be snapshotted for the cache key.

Source

Thrown at core/schema/container.go:2798

	// Key the result on the mounted content rather than the source directory's
	// recipe, mirroring BuildKit's content-checksummed bind-mount cache keys.
	// A taught content digest is a global alias for the result's cache identity,
	// so it must still include everything that distinguishes this container:
	// the parent it was built from and the target/readOnly mount config.
	parentDgst, err := parent.ContentPreferredDigest(ctx)
	if err != nil {
		return inst, fmt.Errorf("failed to content hash dockerfile bind mount: parent digest: %w", err)
	}
	dagqlCache, err := dagql.EngineCache(ctx)
	if err != nil {
		return inst, err
	}
	if err := dagqlCache.Evaluate(ctx, dir); err != nil {
		return inst, fmt.Errorf("failed to content hash dockerfile bind mount: evaluate source: %w", err)
	}
	srcSnapshot, err := dir.Self().Snapshot.GetOrEval(ctx, dir.Result)
	if err != nil {
		return inst, fmt.Errorf("failed to content hash dockerfile bind mount: source snapshot: %w", err)
	}
	srcRoot, err := dir.Self().Dir.GetOrEval(ctx, dir.Result)
	if err != nil {
		return inst, fmt.Errorf("failed to content hash dockerfile bind mount: source path: %w", err)
	}
	srcHash := "empty"
	if srcSnapshot != nil {
		dgst, err := core.GetContentHashFromFile(ctx, srcSnapshot, path.Join(srcRoot, args.SourcePath))
		if err != nil {
			return inst, fmt.Errorf("failed to content hash dockerfile bind mount at %q: %w", args.SourcePath, err)
		}
		srcHash = string(dgst)
	}
	return inst.WithContentDigest(ctx, hashutil.HashStrings(
		"__withMountedPathDockerfileCompat",
		string(parentDgst),
		target,
		strconv.FormatBool(args.ReadOnly),

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Read the wrapped inner error to identify the snapshot/storage failure.
  2. Check engine content store health and disk space; re-run the pipeline step producing the source directory.
  3. Retry the build; if persistent, clear/rebuild the engine's cache state.
Defensive patterns

Strategy: retry

Try / catch

if err := mount(ctx); err != nil {
    if strings.Contains(err.Error(), "source snapshot") {
        // check store health, retry
    }
}

Prevention

When it happens

Trigger: Snapshot.GetOrEval fails for the mount source Directory — the underlying checkpoint/snapshot of the directory tree cannot be materialized (storage error, missing blob, failed evaluation).

Common situations: Corrupted or pruned content-addressable store; directory whose snapshot evaluation hits an engine/storage error; very large directories timing out during snapshot.

Related errors


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