dagger/dagger · error
select %s returned unresolved object result %q (shared resul
Error message
select %s returned unresolved object result %q (shared result %d: hasValue=%t, persistedEnvelope=%t)
What it means
dagql's Select walked a selection chain and got a field result whose Unwrap() is nil, yet the result is an object-typed result backed by a cache SharedResult whose payload never resolved (hasValue=false or no persisted envelope). The server reports the type name, shared-result cache ID, and payload state to help diagnose why the cached object result never received its value.
Source
Thrown at dagql/server.go:1975
state := shared.loadPayloadState()
if state.isObject {
typeName := sharedResultObjectTypeName(shared, state)
return fmt.Errorf(
"select %s returned unresolved object-typed result %q (shared result %d: hasValue=%t, persistedEnvelope=%t)",
sel.Field,
typeName,
shared.id,
state.hasValue,
state.persistedEnvelope != nil,
)
}
}
if _, ok := res.(AnyObjectResult); ok {
typeName := ""
if shared := res.cacheSharedResult(); shared != nil {
payload := shared.loadPayloadState()
typeName = sharedResultObjectTypeName(shared, payload)
return fmt.Errorf(
"select %s returned unresolved object result %q (shared result %d: hasValue=%t, persistedEnvelope=%t)",
sel.Field,
typeName,
shared.id,
payload.hasValue,
payload.persistedEnvelope != nil,
)
}
return fmt.Errorf("select %s returned unresolved object result %q", sel.Field, typeName)
}
// null scalar result; nothing to do
return nil
}
if nth != 0 {
res, err = s.loadNthValue(ctx, res, nth, true)
if err != nil {
return errView on GitHub (pinned to 82ba2681db)
Solutions
- Inspect the reported hasValue/persistedEnvelope flags: if both false, the shared result was never hydrated - re-issue the originating call instead of loading from a stale ID
- Check that the ID being selected through was produced by the same engine instance/cache generation; regenerate the ID
- Verify the field resolver always returns a non-nil value even on partial failure, rather than caching an empty result
- If reproducible after an engine restart, clear or version the dagql cache so orphaned shared results are invalidated
Example fix
// before: selecting through a stale cached ID
var dir dagql.ObjectResult[*core.Directory]
srv.Select(ctx, root, &dir, dagql.Selector{Field: "directory", Args: ...})
// after: re-create the object in-session so a fresh hydrated result exists
dirObj, err := client.Directory().WithNewFile("a.txt", "hi")
_, err = srv.Select(ctx, root, &dir, dagql.Selector{Field: "loadDirectoryFromID", Args: dagql.NewInput("id", dirObj.ID())}) Defensive patterns
Strategy: validation
Validate before calling
// verify shared result state before selecting through a cached ID
func canSelectFromID(ctx context.Context, srv *dagql.Server, id string) bool {
var probe dagql.ObjectResult[*core.Directory]
err := srv.Select(ctx, dagql.NewRoot[*core.Query](), &probe, dagql.Selector{Field: "loadID", Args: dagql.NewInput("id", id)})
return err == nil && probe.Unwrap() != nil
} Type guard
func isHydrated(res dagql.AnyResult) bool {
return res != nil && res.Unwrap() != nil
} Prevention
- Never persist dagql IDs across engine restarts or cache generations
- Check hasValue on cache state when loading from stored IDs
- Re-issue originating calls instead of replaying old shared results
When it happens
Trigger: Calling Server.Select with a selector whose field resolves to an ObjectResult that was cached/shared but never hydrated - e.g. the underlying call failed silently, the shared result's payload was never populated (hasValue=false), or a persisted envelope is missing (persistedEnvelope=false) when loading from the cache.
Common situations: Cross-session ID loading where a cached shared result exists but its persisted payload was evicted or never written; race or cancellation that aborted payload hydration; engine restart with a stale/incompatible cache referencing shared result IDs.
Related errors
- call %s.%s: current dagql cache: %w
- failed parsing [%s], expected address format: [%s]
- use target SDK language: %s: %w
- unmarshal introspection json: %w
- failed to apply generated code: %w
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/34154337643f8db4.
Report an issue: GitHub.