dagger/dagger · error
load %s: instantiate base: %w
Error message
load %s: instantiate base: %w
What it means
Once inputs are loaded, the base (receiver or root) result must be converted to a selectable object via srv.toSelectable. If the base result cannot be instantiated as a selectable (wrong result kind, nil payload, unsupported type), the load fails with 'instantiate base'.
Source
Thrown at dagql/server.go:1549
return nil
})
}
if err := eg.Wait(); err != nil {
return nil, fmt.Errorf("load %s: inputs: %w", idInputDebugString(id), err)
}
var base AnyResult
if receiver := id.Receiver(); receiver != nil {
base = loadedInputs[receiver.Digest().String()]
if base == nil {
return nil, fmt.Errorf("load %s: missing loaded receiver", idInputDebugString(id))
}
} else {
base = state.srv.root
}
baseObj, err := state.srv.toSelectable(state.ctx, base)
if err != nil {
return nil, fmt.Errorf("load %s: instantiate base: %w", idInputDebugString(id), err)
}
frame, err := state.loadedResultCallFromRecipeID(id, loadedInputs, lazyRefs)
if err != nil {
return nil, fmt.Errorf("load %s: build result call: %w", idInputDebugString(id), err)
}
callCtx = ContextWithCall(callCtx, frame)
sel, err := selectorFromLoadedCall(callCtx, frame, baseObj, id, lazyRefs)
if err != nil {
return nil, fmt.Errorf("load %s: %w", idInputDebugString(id), err)
}
req := &CallRequest{ResultCall: frame}
if hit, ok, err := state.cache.lookupCallRequest(callCtx, state.sessionID, state.srv, req); err != nil {
return nil, fmt.Errorf("load %s: structural cache lookup: %w", idInputDebugString(id), err)
} else if ok {
return hit, nil
}
return baseObj.Select(callCtx, state.srv, sel)
}View on GitHub (pinned to 82ba2681db)
Solutions
- Verify the ID chain targets an object-returning selection (not a scalar) before further selection
- Re-run the query to rebuild results if the payload was evicted
- Check engine logs for the underlying toSelectable failure wrapped in %w
- If embedding dagql, ensure Server root is a properly registered selectable object
Defensive patterns
Strategy: validation
Validate before calling
// ensure the selection chain ends in an object type before loading deeper
if id != nil && id.Type() != nil && id.Type().Kind() == dagql.ScalarKind {
return errors.New("cannot select fields on a scalar result")
} Type guard
func isSelectableBase(res dagql.AnyResult) bool {
return res != nil && res.Type() != nil &&
(res.Type().Kind() == dagql.ObjectKind || res.Type().Kind() == dagql.InterfaceKind)
} Try / catch
res, err := srv.LoadType(ctx, id)
if err != nil {
if strings.Contains(err.Error(), "instantiate base") {
// base result is not a selectable object; rebuild the chain from the root
}
return err
} Prevention
- Only chain further selections off object-typed results
- Re-run queries if payloads may have been evicted between steps
- When embedding dagql, register the root object correctly
- Check engine logs for the underlying toSelectable cause
When it happens
Trigger: toSelectable fails on the base AnyResult — e.g. the receiver's cached result is not an object/selectable kind, its payload was evicted or is nil, or the root object wiring is wrong.
Common situations: Loading an ID whose receiver resolves to a scalar/enum instead of an object; cache eviction of the payload between the lookup and instantiation; embedding dagql with a misconfigured root object.
Related errors
- cannot instantiate %T with %T
- cannot instantiate %T with %T: missing shared result
- instantiate: %w
- failed parsing [%s], expected address format: [%s]
- use target SDK language: %s: %w
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/a4a00387740b2748.
Report an issue: GitHub.