dagger/dagger · error

directory module source %q context ID: %w

Error message

directory module source %q context ID: %w

What it means

After confirming the dir-kind source has an OriginalContextDir, deduplicateAndSortItems calls OriginalContextDir.ID() to derive the symbolic identity. If computing the content-addressed ID of that Directory fails, the underlying error is wrapped and rethrown with this message.

Source

Thrown at core/schema/modulesource.go:1686

		case core.ModuleSourceKindGit:
			symbolicItemStr = item.Self().Git.CloneRef
			if item.Self().SourceRootSubpath != "" {
				symbolicItemStr += "/" + strings.TrimPrefix(item.Self().SourceRootSubpath, "/")
			}
			if accessor.typ == core.ModuleRelationTypeToolchain {
				if item.Self().Git.Version != "" {
					symbolicItemStr += "@" + item.Self().Git.Version
				} else if item.Self().Git.Commit != "" {
					symbolicItemStr += "@" + item.Self().Git.Commit
				}
			}
		case core.ModuleSourceKindDir:
			if item.Self().DirSrc == nil || item.Self().DirSrc.OriginalContextDir.Self() == nil {
				return nil, fmt.Errorf("directory module source %q has no original context", item.Self().ModuleName)
			}
			contextID, err := item.Self().DirSrc.OriginalContextDir.ID()
			if err != nil {
				return nil, fmt.Errorf("directory module source %q context ID: %w", item.Self().ModuleName, err)
			}
			encodedContextID, err := contextID.Encode()
			if err != nil {
				return nil, fmt.Errorf("encode directory module source %q context ID: %w", item.Self().ModuleName, err)
			}
			symbolicItemStr = encodedContextID + "\x00" + filepath.Clean(item.Self().SourceRootSubpath)
		}

		if _, isDuplicateSymbolic := symbolicItems[symbolicItemStr]; isDuplicateSymbolic {
			continue
		}
		symbolicItems[symbolicItemStr] = item

		if _, isDuplicateName := itemNames[item.Self().ModuleName]; isDuplicateName {
			return nil, fmt.Errorf("duplicate %s name %q", accessor.typ, item.Self().ModuleName)
		}
		itemNames[item.Self().ModuleName] = item
	}

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Inspect the wrapped error for the root cause (content store / ID computation failure).
  2. Restart the dagger engine to rebuild in-memory state; check engine logs for content-store errors.
  3. Re-resolve the module source fresh from its ref rather than a cached instance.
  4. If the content store is corrupt, clear/rebuild the dagger engine state (dagger engine prune / reset).
Defensive patterns

Strategy: try-catch

Try / catch

err := mod.UpdateDependencies(ctx, deps)
if err != nil && strings.Contains(err.Error(), "context ID") {
    // engine/content-store issue: restart engine and retry once
    return retryAfterEngineRestart(ctx, mod, deps)
}

Prevention

When it happens

Trigger: moduleSourceWithDependencies enumerating dependencies of a module with a dir-kind source whose OriginalContextDir.ID() errors — typically an internal failure resolving the directory's content hash or its underlying blob missing from the content store.

Common situations: Corrupted or pruned content-addressable store (dagger engine cache eviction/corruption); a Directory handle pointing at content that no longer exists; engine bugs during ID computation.

Related errors


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