{"record":{"id":"e049a2f8e35e9152","repo":"dagger/dagger","slug":"apply-changes-to-workspace-root-w","errorCode":null,"errorMessage":"apply changes to workspace root: %w","messagePattern":"apply changes to workspace root: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/generators.go","lineNumber":345,"sourceCode":"\t\treturn dagql.ObjectResult[*Directory]{}, err\n\t}\n\tvar root dagql.ObjectResult[*Directory]\n\tif err := dag.Select(ctx, gg.BoundWorkspace, &root, dagql.Selector{\n\t\tField: \"directory\",\n\t\tArgs:  []dagql.NamedInput{{Name: \"path\", Value: dagql.NewString(\"/\")}},\n\t}); err != nil {\n\t\treturn dagql.ObjectResult[*Directory]{}, fmt.Errorf(\"read workspace root: %w\", err)\n\t}\n\tfor _, cs := range changes {\n\t\tcsID, err := cs.ID()\n\t\tif err != nil {\n\t\t\treturn dagql.ObjectResult[*Directory]{}, fmt.Errorf(\"changeset ID: %w\", err)\n\t\t}\n\t\tif err := dag.Select(ctx, root, &root, dagql.Selector{\n\t\t\tField: \"withChanges\",\n\t\t\tArgs:  []dagql.NamedInput{{Name: \"changes\", Value: dagql.NewID[*Changeset](csID)}},\n\t\t}); err != nil {\n\t\t\treturn dagql.ObjectResult[*Directory]{}, fmt.Errorf(\"apply changes to workspace root: %w\", err)\n\t\t}\n\t}\n\treturn root, nil\n}\n\n// verifySkippedModule loads one skipped module from the generated workspace\n// root and records the outcome on its \"regenerated\" span: OK, or the described\n// post-generation load error. The span's status is the whole answer; the\n// report words a success itself (idtui regeneratedModuleMessage).\nfunc verifySkippedModule(ctx context.Context, generated dagql.ObjectResult[*Directory], failure ModuleLoadFailure) {\n\tvar rerr error\n\tctx, span := Tracer(ctx).Start(ctx, failure.Name,\n\t\ttelemetry.Reveal(),\n\t\ttrace.WithAttributes(\n\t\t\tattribute.Bool(telemetryattrs.GenerateRegeneratedAttr, true),\n\t\t\tattribute.Bool(telemetry.UIRollUpLogsAttr, true),\n\t\t\tattribute.Bool(telemetry.UIRollUpSpansAttr, true),\n\t\t),","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/generators.go#L327-L363","documentation":"This error wraps a failure of the dagql Select call that applies a changeset to the workspace root directory via Directory.withChanges, inside generatedWorkspaceRoot. The root is read as a full Directory (not the sparse workspace overlay) and each run changeset is chained on; if the select/query fails (invalid changeset, directory read error, engine error), the workspace-root generation aborts.","triggerScenarios":"generatedWorkspaceRoot iterating over run changesets when dag.Select(ctx, root, &root, {Field: \"withChanges\"}) returns an error — e.g. the changeset ID is invalid, the base directory failed to materialize, or the engine errored evaluating withChanges.","commonSituations":"Engine storage/cache corruption preventing the base directory or changeset blobs from being read; a changeset produced by a failed/aborted generator step; very large changesets failing during evaluation; version mismatch between CLI and engine causing field/argument incompatibilities.","solutions":["Inspect the wrapped cause (%w) — it names the actual withChanges failure","Re-run with a healthy engine cache; clear or GC corrupted engine cache state if blobs are unreadable","Ensure CLI and engine versions match (dagger engine upgrade / CLI upgrade in lockstep)","If a specific module's changeset triggers it, regenerate that module in isolation to identify the offending changes"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Verify the base directory resolves before applying changes:\nvar probe dagql.ObjectResult[*Directory]\nif err := dag.Select(ctx, gg.BoundWorkspace, &probe, dagql.Selector{\n    Field: \"directory\",\n    Args:  []dagql.NamedInput{{Name: \"path\", Value: dagql.NewString(\"/\")}},\n}); err != nil {\n    return fmt.Errorf(\"workspace root unreadable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := dag.Select(ctx, root, &root, dagql.Selector{Field: \"withChanges\", Args: ...}); err != nil {\n    if errors.Is(err, context.DeadlineExceeded) {\n        // retry with a larger timeout\n    }\n    return fmt.Errorf(\"apply changes to workspace root: %w\", err)\n}","preventionTips":["Keep engine cache storage healthy and sized for the workspace","Match CLI/engine versions to avoid withChanges schema skew","Regenerate failed modules individually to isolate a bad changeset","Avoid killing the engine mid-write of changeset blobs"],"tags":["dagger","codegen","directory","dagql"],"backgroundTag":"withchanges-apply-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"}