dagger/dagger · error
failed to load existing %s: %w
Error message
failed to load existing %s: %w
What it means
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>'.
Source
Thrown at core/schema/modulesource.go:1762
var newUpdatedArgs []core.ModuleSourceID
for _, existingItem := range accessor.getItems(parentSrc.Self()) {
if len(updateReqs) == 0 {
if existingItem.Self().Kind == core.ModuleSourceKindLocal {
continue
}
var updatedItem dagql.ObjectResult[*core.ModuleSource]
err := dag.Select(updateCtx, dag.Root(), &updatedItem,
dagql.Selector{
Field: "moduleSource",
Args: []dagql.NamedInput{
{Name: "refString", Value: dagql.String(moduleSourceDeclaredRef(existingItem.Self()))},
},
},
)
if err != nil {
return nil, fmt.Errorf("failed to load existing %s: %w", accessor.typ, err)
}
updatedItemID, err := updatedItem.ID()
if err != nil {
return nil, fmt.Errorf("failed to get updated %s ID: %w", accessor.typ, err)
}
newUpdatedArgs = append(newUpdatedArgs, dagql.NewID[*core.ModuleSource](updatedItemID))
continue
}
if existingItem.Self().Kind == core.ModuleSourceKindLocal {
for updateReq := range updateReqs {
if updateReq.symbolic == existingItem.Self().ModuleName {
return nil, fmt.Errorf("updating local %s is not supported", accessor.typ.Plural())
}
var contextRoot string
switch parentSrc.Self().Kind {View on GitHub (pinned to 82ba2681db)
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.
Example fix
// before: unreachable ref
.withDependency(gitRef("github.com/myorg/removed-repo"))
// after: fix to the moved location
.withDependency(gitRef("github.com/myorg/renamed-repo")) Defensive patterns
Strategy: retry
Validate before calling
// Go: pre-check that each git dep remote is reachable before updating
for _, dep := range gitDeps {
if err := checkRemoteReachable(dep.CloneRef); err != nil {
return fmt.Errorf("dep %s remote unreachable: %w", dep.ModuleName, err)
}
} Try / catch
err := mod.UpdateDependencies(ctx, nil) // update all
if err != nil && strings.Contains(err.Error(), "failed to load existing") {
if isTransient(err) { // network timeouts
time.Sleep(2 * time.Second)
err = mod.UpdateDependencies(ctx, nil)
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- load contextual git repository: %w
- failed to resolve git tags: %w
- failed to resolve git src: %w
- failed to load updated %s: %w
- cannot set both noNetwork and hostNetwork
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/12189a96ece856c1.
Report an issue: GitHub.