{"record":{"id":"0286c568c2152ca9","repo":"dagger/dagger","slug":"load-comparison-workspace-w","errorCode":null,"errorMessage":"load comparison workspace: %w","messagePattern":"load comparison workspace: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/schema/workspace.go","lineNumber":1938,"sourceCode":"\t\t} else {\n\t\t\tempty, err := core.NewEmptyChangeset(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn inst, err\n\t\t\t}\n\t\t\tchanges, err = dagql.NewObjectResultForCurrentCall(ctx, srv, empty)\n\t\t\tif err != nil {\n\t\t\t\treturn inst, err\n\t\t\t}\n\t\t}\n\t\tif callerPastChangesetCwdCutover(ctx) {\n\t\t\treturn reRootChangesetToCwd(ctx, changes, parent.Self().Cwd)\n\t\t}\n\t\treturn changes, nil\n\t}\n\n\tfrom, err := args.From.Value.Load(ctx, srv)\n\tif err != nil {\n\t\treturn inst, fmt.Errorf(\"load comparison workspace: %w\", err)\n\t}\n\tchanges, err := s.workspaceChangesBetween(ctx, from, parent)\n\tif err != nil {\n\t\treturn inst, err\n\t}\n\n\tif callerPastChangesetCwdCutover(ctx) {\n\t\treturn reRootChangesetToCwd(ctx, changes, parent.Self().Cwd)\n\t}\n\treturn changes, nil\n}\n\n// workspaceChangesBetween compares two workspace values without materializing\n// an entire client-local workspace. Host-backed workspaces are reconstructed\n// over a sparse host view containing only paths touched by either side; all\n// other workspace kinds already have full in-engine roots.\nfunc (s *workspaceSchema) workspaceChangesBetween(\n\tctx context.Context,","sourceCodeStart":1920,"sourceCodeEnd":1956,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/schema/workspace.go#L1920-L1956","documentation":"Workspace.changes supports diffing against a second workspace passed via the From argument. Before comparing, the From workspace ID is loaded back into an object (args.From.Value.Load). Any failure resolving that ID is wrapped as \"load comparison workspace: %w\", so the underlying cause (invalid/stale ID, missing object, engine error) surfaces with this context prefix.","triggerScenarios":"Calling workspace.changes(from: <workspaceID>) where the ID cannot be loaded: it references a deleted/non-existent Workspace, is malformed, or the engine errors while materializing the referenced workspace.","commonSituations":"Reusing a saved workspace ID from a previous session or different pipeline run; truncating or mis-concatenating the ID string; using an ID from another client/query context.","solutions":["Inspect the wrapped inner error to see the actual load failure cause.","Re-obtain the From workspace ID from a live query in the same session rather than reusing a stored one.","Validate the ID string before passing it (not truncated, correct type — Workspace not Directory).","Retry if the inner cause was a transient engine error."],"exampleFix":"// before\nchanges := ws.Changes(ctx, dagger.WorkspaceChangesOpts{From: oldSavedID}) // may fail to load\n// after\nfromWs := client.Workspace().WithDirectory(...) // recreate From workspace in-session\nchanges := ws.Changes(ctx, dagger.WorkspaceChangesOpts{From: fromWs.ID()})","handlingStrategy":"try-catch","validationCode":"// ensure the ID is a non-empty, plausible dagql ID before calling changes\nif fromID == \"\" || !strings.Contains(fromID, \":\") {\n    return errors.New(\"invalid workspace ID for From argument\")\n}","typeGuard":null,"tryCatchPattern":"changes, err := ws.Changes(ctx, dagger.WorkspaceChangesOpts{From: fromID})\nif err != nil {\n    if strings.Contains(err.Error(), \"load comparison workspace\") {\n        from := client.Host().Workspace(\".\") // recreate From in this session\n        changes, err = ws.Changes(ctx, dagger.WorkspaceChangesOpts{From: from.ID()})\n    }\n    if err != nil {\n        return err\n    }\n}","preventionTips":["Never persist workspace IDs across sessions; recreate workspaces per run.","Pass live Workspace objects/IDs obtained in the same client session.","Validate ID strings for truncation or type mix-ups (Workspace vs Directory)."],"tags":["dagger","workspace","id-loading","graphql"],"backgroundTag":"id-resolution-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"}