{"record":{"id":"977e2d145368f8be","repo":"dagger/dagger","slug":"evaluate-structural-diff-w","errorCode":null,"errorMessage":"evaluate structural diff: %w","messagePattern":"evaluate structural diff: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/directory.go","lineNumber":3095,"sourceCode":"\t}\n\n\tvar diffDir dagql.ObjectResult[*Directory]\n\tafterID, err := changes.Self().After.ID()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"after ID: %w\", err)\n\t}\n\tif err := srv.Select(ctx, changes.Self().Before, &diffDir,\n\t\tdagql.Selector{\n\t\t\tField: \"diff\",\n\t\t\tArgs: []dagql.NamedInput{\n\t\t\t\t{Name: \"other\", Value: dagql.NewID[*Directory](afterID)},\n\t\t\t},\n\t\t},\n\t); err != nil {\n\t\treturn fmt.Errorf(\"compute structural diff: %w\", err)\n\t}\n\tif err := cache.Evaluate(ctx, diffDir); err != nil {\n\t\treturn fmt.Errorf(\"evaluate structural diff: %w\", err)\n\t}\n\n\tvar diffSnapshot bkcache.ImmutableRef\n\tdiffPath := \"/\"\n\tif diffDir.Self() != nil {\n\t\tdiffSnapshot, err = diffDir.Self().Snapshot.GetOrEval(ctx, diffDir.Result)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"diff snapshot: %w\", err)\n\t\t}\n\t\tdiffPath, err = diffDir.Self().Dir.GetOrEval(ctx, diffDir.Result)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"diff path: %w\", err)\n\t\t}\n\t\tif diffPath == \"\" {\n\t\t\tdiffPath = \"/\"\n\t\t}\n\t}\n","sourceCodeStart":3077,"sourceCodeEnd":3113,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/directory.go#L3077-L3113","documentation":"This error wraps failure of cache.Evaluate on the diff directory result. Computing the diff via srv.Select only queues the lazy dagql call; Evaluate forces it to run. Failure here means the diff directory's underlying evaluation (snapshot construction) errored or the context was canceled.","triggerScenarios":"Applying a Directory changeset where evaluating the intermediate Before.diff(other) result fails — e.g. blob mounts unavailable, disk full, engine cache ref lost mid-evaluation, or client disconnects canceling the context.","commonSituations":"Engine under disk pressure while materializing diff layers; session cancellation; flaky underlying storage in remote cache setups.","solutions":["Read the wrapped cause; 'context canceled' means the client disconnected — rerun the operation.","Free engine disk / prune cache if evaluation failed from ENOSPC, then retry.","Verify engine and CLI versions match; mismatched builds can fail evaluation of lazily-created objects.","Retry the pipeline; if reproducible, capture engine logs and report with the inner error."],"exampleFix":"// before\nif err := cache.Evaluate(ctx, diffDir); err != nil {\n\treturn fmt.Errorf(\"evaluate structural diff: %w\", err)\n}\n// after\nif err := cache.Evaluate(ctx, diffDir); err != nil {\n\treturn fmt.Errorf(\"evaluate structural diff: %w\", err) // check inner cause: canceled vs IO vs cache\n}","handlingStrategy":"retry","validationCode":"if ctx.Err() != nil { return errors.New(\"context canceled before diff evaluation\") }\n// verify sufficient engine disk before large diffs","typeGuard":null,"tryCatchPattern":"for attempt := 0; attempt < 2; attempt++ { if err := evalDiff(); err == nil { break }; if !isTransient(err) { return err } }","preventionTips":["Keep engine disk usage below capacity (prune cache regularly)","Retry transient evaluation errors once","Avoid disconnecting the client mid-pipeline","Watch for remote-cache blob errors and re-push when needed"],"tags":["dagger","cache","evaluation","directory"],"backgroundTag":"lazy-evaluation-failed","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"}