{"record":{"id":"c70ad0ce6a706cca","repo":"dagger/dagger","slug":"call-s-s-current-dagql-cache-w","errorCode":null,"errorMessage":"call %s.%s: current dagql cache: %w","messagePattern":"call (.+?)\\.(.+?): current dagql cache: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"dagql/objects.go","lineNumber":681,"sourceCode":"\t\tdefer func() {\n\t\t\tvar cached bool\n\t\t\tif res != nil {\n\t\t\t\tcached = res.HitCache()\n\t\t\t}\n\t\t\tdone(res, cached, &err)\n\t\t}()\n\t\tctx = telemetryCtx\n\t}\n\tclientMetadata, err := engine.ClientMetadataFromContext(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"call %s.%s: current client metadata: %w\", r.class.inner.Type().Name(), fieldName, err)\n\t}\n\tif clientMetadata.SessionID == \"\" {\n\t\treturn nil, fmt.Errorf(\"call %s.%s: empty session ID\", r.class.inner.Type().Name(), fieldName)\n\t}\n\tcache, err := EngineCache(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"call %s.%s: current dagql cache: %w\", r.class.inner.Type().Name(), fieldName, err)\n\t}\n\n\tres, err = cache.GetOrInitCall(ctx, clientMetadata.SessionID, s, req, func(ctx context.Context) (AnyResult, error) {\n\t\tval, err := field.Func(ctx, r, inputArgs, view)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif val == nil {\n\t\t\treturn nil, nil\n\t\t}\n\n\t\tval, ok = val.DerefValue()\n\t\tif !ok {\n\t\t\treturn nil, nil\n\t\t}\n\t\tnth := int(req.Nth)\n\t\tif nth != 0 {\n\t\t\tval, err = val.NthValue(ctx, nth)","sourceCodeStart":663,"sourceCodeEnd":699,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/dagql/objects.go#L663-L699","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nctx := context.Background()\nout, err := obj.Select(ctx, id, \"query\")\n// after\nctx := engineCtx // context produced by engine bootstrap containing the dagql cache\nout, err := obj.Select(ctx, id, \"query\")","handlingStrategy":"validation","validationCode":"if _, err := EngineCache(ctx); err != nil {\n    return fmt.Errorf(\"engine cache missing from context: %w\", err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["dagql","go","cache","context","graphql"],"backgroundTag":"missing-context-value","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"}