{"record":{"id":"a85f70dc787cdad3","repo":"dagger/dagger","slug":"failed-to-load-contextual-git-repository-w","errorCode":null,"errorMessage":"failed to load contextual git repository: %w","messagePattern":"failed to load contextual git repository: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/modulesource.go","lineNumber":1950,"sourceCode":"\t\treturn inst, nil\n\t}\n\n\tif src.Kind == ModuleSourceKindGit {\n\t\t// easy, we're running a git repo\n\t\terr := dag.Select(ctx, dag.Root(), &inst,\n\t\t\tdagql.Selector{\n\t\t\t\tField: \"git\",\n\t\t\t\tArgs: []dagql.NamedInput{\n\t\t\t\t\t{Name: \"url\", Value: dagql.String(src.Git.CloneRef)},\n\t\t\t\t\t// NOTE: pin HEAD to the module's git commit and ref\n\t\t\t\t\t// this matches the behavior of calling a checked out local source module\n\t\t\t\t\t{Name: \"commit\", Value: dagql.String(src.Git.Commit)},\n\t\t\t\t\t{Name: \"ref\", Value: dagql.String(src.Git.Ref)},\n\t\t\t\t},\n\t\t\t},\n\t\t)\n\t\tif err != nil {\n\t\t\treturn inst, fmt.Errorf(\"failed to load contextual git repository: %w\", err)\n\t\t}\n\t\treturn inst, nil\n\t}\n\n\t// bit harder, this is actually a local directory\n\tdir, err := src.LoadContextDir(ctx, dag, \"/\", CopyFilter{\n\t\tGitignore: true,\n\t})\n\tif err != nil {\n\t\treturn inst, fmt.Errorf(\"failed to load contextual git: %w\", err)\n\t}\n\n\tif src.Kind == ModuleSourceKindLocal {\n\t\t// The engine never interprets the host checkout's raw git layout\n\t\t// (worktree/submodule pointer files, commondirs, separate git dirs):\n\t\t// replace whatever .git the synced tree carries with a canonical\n\t\t// reconstruction of the checkout's repository, packed by the client's\n\t\t// own git. Route through the owning client, as loading host paths does.","sourceCodeStart":1932,"sourceCodeEnd":1968,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/modulesource.go#L1932-L1968","documentation":"For a plain git module source, loading the contextual GitRepository by selecting git(url, commit, ref) from the root failed. The clone ref, pinned commit, or ref name could not be resolved — e.g. network/auth failure, deleted commit, or unknown ref — and the error wraps the underlying git load failure.","triggerScenarios":"Thrown at core/modulesource.go:1950 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the git clone URL is reachable (network and credentials)","Check that the pinned commit and ref still exist in the repository","Inspect the wrapped error for the specific clone/checkout failure","Ensure required service bindings or auth tokens for the repo are configured"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}