dagger/dagger · error
call %s.%s: current dagql cache: %w
Error message
call %s.%s: current dagql cache: %w
What it means
After validating client metadata, dagql looks up the engine cache from the context (`EngineCache(ctx)`) to run GetOrInitCall for this field invocation. If the context does not carry an engine cache, the call cannot be cached or executed and this wrapped error is returned (dagql/objects.go:681).
Source
Thrown at dagql/objects.go:681
defer func() {
var cached bool
if res != nil {
cached = res.HitCache()
}
done(res, cached, &err)
}()
ctx = telemetryCtx
}
clientMetadata, err := engine.ClientMetadataFromContext(ctx)
if err != nil {
return nil, fmt.Errorf("call %s.%s: current client metadata: %w", r.class.inner.Type().Name(), fieldName, err)
}
if clientMetadata.SessionID == "" {
return nil, fmt.Errorf("call %s.%s: empty session ID", r.class.inner.Type().Name(), fieldName)
}
cache, err := EngineCache(ctx)
if err != nil {
return nil, fmt.Errorf("call %s.%s: current dagql cache: %w", r.class.inner.Type().Name(), fieldName, err)
}
res, err = cache.GetOrInitCall(ctx, clientMetadata.SessionID, s, req, func(ctx context.Context) (AnyResult, error) {
val, err := field.Func(ctx, r, inputArgs, view)
if err != nil {
return nil, err
}
if val == nil {
return nil, nil
}
val, ok = val.DerefValue()
if !ok {
return nil, nil
}
nth := int(req.Nth)
if nth != 0 {
val, err = val.NthValue(ctx, nth)View on GitHub (pinned to 82ba2681db)
Solutions
- Obtain the context from the engine/server entry point (Select on a server created by the engine bootstrap) instead of context.Background().
- In tests, replicate the setup used by TestImplicitInputCachePerSchema/TestImplicitInputCacheAsRequested which installs the cache.
- Read the wrapped error for the underlying reason (e.g. missing value in ctx) and add the corresponding engine-cache context setup step.
Example fix
// before ctx := context.Background() out, err := obj.Select(ctx, id, "query") // after ctx := engineCtx // context produced by engine bootstrap containing the dagql cache out, err := obj.Select(ctx, id, "query")
Defensive patterns
Strategy: validation
Validate before calling
if _, err := EngineCache(ctx); err != nil {
return fmt.Errorf("engine cache missing from context: %w", err)
} Prevention
- Only invoke dagql field functions with contexts produced by the engine bootstrap.
- Never strip values when re-wrapping contexts across goroutines (use context.WithValue on the engine ctx).
- Add an early guard in test utilities that build dagql contexts.
When it happens
Trigger: Calling a dagql field with a context that was never initialized with the engine cache — typically a bare/test context or one built outside the engine's request lifecycle.
Common situations: Embedding dagql without calling the engine bootstrap that installs the cache in ctx; unit tests exercising field functions directly; spawning a goroutine with a stripped context.
Related errors
- resolve ID input %q: current dagql cache: %w
- call %s.%s: current client metadata: %w
- load before: %w
- load after: %w
- attach mod tree module: %w
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/c70ad0ce6a706cca.
Report an issue: GitHub.