{"record":{"id":"cc892ed4a1c1a0be","repo":"dagger/dagger","slug":"directory-module-source-q-context-id-w","errorCode":null,"errorMessage":"directory module source %q context ID: %w","messagePattern":"directory module source %q context ID: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/schema/modulesource.go","lineNumber":1686,"sourceCode":"\t\tcase core.ModuleSourceKindGit:\n\t\t\tsymbolicItemStr = item.Self().Git.CloneRef\n\t\t\tif item.Self().SourceRootSubpath != \"\" {\n\t\t\t\tsymbolicItemStr += \"/\" + strings.TrimPrefix(item.Self().SourceRootSubpath, \"/\")\n\t\t\t}\n\t\t\tif accessor.typ == core.ModuleRelationTypeToolchain {\n\t\t\t\tif item.Self().Git.Version != \"\" {\n\t\t\t\t\tsymbolicItemStr += \"@\" + item.Self().Git.Version\n\t\t\t\t} else if item.Self().Git.Commit != \"\" {\n\t\t\t\t\tsymbolicItemStr += \"@\" + item.Self().Git.Commit\n\t\t\t\t}\n\t\t\t}\n\t\tcase core.ModuleSourceKindDir:\n\t\t\tif item.Self().DirSrc == nil || item.Self().DirSrc.OriginalContextDir.Self() == nil {\n\t\t\t\treturn nil, fmt.Errorf(\"directory module source %q has no original context\", item.Self().ModuleName)\n\t\t\t}\n\t\t\tcontextID, err := item.Self().DirSrc.OriginalContextDir.ID()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"directory module source %q context ID: %w\", item.Self().ModuleName, err)\n\t\t\t}\n\t\t\tencodedContextID, err := contextID.Encode()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"encode directory module source %q context ID: %w\", item.Self().ModuleName, err)\n\t\t\t}\n\t\t\tsymbolicItemStr = encodedContextID + \"\\x00\" + filepath.Clean(item.Self().SourceRootSubpath)\n\t\t}\n\n\t\tif _, isDuplicateSymbolic := symbolicItems[symbolicItemStr]; isDuplicateSymbolic {\n\t\t\tcontinue\n\t\t}\n\t\tsymbolicItems[symbolicItemStr] = item\n\n\t\tif _, isDuplicateName := itemNames[item.Self().ModuleName]; isDuplicateName {\n\t\t\treturn nil, fmt.Errorf(\"duplicate %s name %q\", accessor.typ, item.Self().ModuleName)\n\t\t}\n\t\titemNames[item.Self().ModuleName] = item\n\t}","sourceCodeStart":1668,"sourceCodeEnd":1704,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/schema/modulesource.go#L1668-L1704","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the wrapped error for the root cause (content store / ID computation failure).","Restart the dagger engine to rebuild in-memory state; check engine logs for content-store errors.","Re-resolve the module source fresh from its ref rather than a cached instance.","If the content store is corrupt, clear/rebuild the dagger engine state (dagger engine prune / reset)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := mod.UpdateDependencies(ctx, deps)\nif err != nil && strings.Contains(err.Error(), \"context ID\") {\n    // engine/content-store issue: restart engine and retry once\n    return retryAfterEngineRestart(ctx, mod, deps)\n}","preventionTips":["Keep the dagger engine healthy; investigate content-store errors promptly","Restart the engine after abnormal terminations","Re-resolve module sources instead of holding long-lived Directory handles","Watch for cache pruning removing blobs still referenced by open sessions"],"tags":["dagger","module-source","content-store","id-computation"],"backgroundTag":"content-id-resolution-failed","analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}