{"record":{"id":"12189a96ece856c1","repo":"dagger/dagger","slug":"failed-to-load-existing-s-w","errorCode":null,"errorMessage":"failed to load existing %s: %w","messagePattern":"failed to load existing (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/schema/modulesource.go","lineNumber":1762,"sourceCode":"\n\tvar newUpdatedArgs []core.ModuleSourceID\n\tfor _, existingItem := range accessor.getItems(parentSrc.Self()) {\n\t\tif len(updateReqs) == 0 {\n\t\t\tif existingItem.Self().Kind == core.ModuleSourceKindLocal {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tvar updatedItem dagql.ObjectResult[*core.ModuleSource]\n\t\t\terr := dag.Select(updateCtx, dag.Root(), &updatedItem,\n\t\t\t\tdagql.Selector{\n\t\t\t\t\tField: \"moduleSource\",\n\t\t\t\t\tArgs: []dagql.NamedInput{\n\t\t\t\t\t\t{Name: \"refString\", Value: dagql.String(moduleSourceDeclaredRef(existingItem.Self()))},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to load existing %s: %w\", accessor.typ, err)\n\t\t\t}\n\n\t\t\tupdatedItemID, err := updatedItem.ID()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to get updated %s ID: %w\", accessor.typ, err)\n\t\t\t}\n\t\t\tnewUpdatedArgs = append(newUpdatedArgs, dagql.NewID[*core.ModuleSource](updatedItemID))\n\t\t\tcontinue\n\t\t}\n\n\t\tif existingItem.Self().Kind == core.ModuleSourceKindLocal {\n\t\t\tfor updateReq := range updateReqs {\n\t\t\t\tif updateReq.symbolic == existingItem.Self().ModuleName {\n\t\t\t\t\treturn nil, fmt.Errorf(\"updating local %s is not supported\", accessor.typ.Plural())\n\t\t\t\t}\n\n\t\t\t\tvar contextRoot string\n\t\t\t\tswitch parentSrc.Self().Kind {","sourceCodeStart":1744,"sourceCodeEnd":1780,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/schema/modulesource.go#L1744-L1780","documentation":"When updating dependencies/toolchains, each existing non-local item is re-loaded by re-selecting the 'moduleSource' field with its declared ref string on the dagql server. If that select fails (ref resolution error, network/auth failure for git refs, etc.), the error is wrapped as 'failed to load existing <type>'.","triggerScenarios":"updateDependencies()/updateToolchains() where moduleSourceDeclaredRef(existingItem) cannot be re-resolved: unreachable or renamed git remote, invalid ref string, auth failure on private repos, or dagql select error.","commonSituations":"Git dependency remote deleted/moved or renamed branch; private repo credentials missing in the session; network outage during 'dagger develop/update'; dependency ref string malformed after manual dagger.json edits.","solutions":["Read the wrapped error; verify the git remote URL is reachable and credentials are available (dagger auth / git config).","Fix the dependency ref in dagger.json if it was hand-edited into an invalid form.","Retry once network is restored — resolution errors are often transient.","Run 'dagger develop' to re-resolve all deps and see which ref fails."],"exampleFix":"// before: unreachable ref\n.withDependency(gitRef(\"github.com/myorg/removed-repo\"))\n// after: fix to the moved location\n.withDependency(gitRef(\"github.com/myorg/renamed-repo\"))","handlingStrategy":"retry","validationCode":"// Go: pre-check that each git dep remote is reachable before updating\nfor _, dep := range gitDeps {\n    if err := checkRemoteReachable(dep.CloneRef); err != nil {\n        return fmt.Errorf(\"dep %s remote unreachable: %w\", dep.ModuleName, err)\n    }\n}","typeGuard":null,"tryCatchPattern":"err := mod.UpdateDependencies(ctx, nil) // update all\nif err != nil && strings.Contains(err.Error(), \"failed to load existing\") {\n    if isTransient(err) { // network timeouts\n        time.Sleep(2 * time.Second)\n        err = mod.UpdateDependencies(ctx, nil)\n    }\n}","preventionTips":["Verify git remotes exist and are reachable before updating","Configure credentials for private repos in the dagger session","Fix hand-edited refs in dagger.json before running updates","Retry transient network failures with backoff"],"tags":["dagger","git","network","module-update"],"backgroundTag":"git-ref-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"}