{"record":{"id":"bf03e08fa5ddb913","repo":"dagger/dagger","slug":"attach-bound-workspace-w","errorCode":null,"errorMessage":"attach bound workspace: %w","messagePattern":"attach bound workspace: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/current_module_as_sdk.go","lineNumber":198,"sourceCode":"\t}\n\treturn c, nil\n}\n\n// AttachDependencyResults attaches the bound workspace so it becomes cache-backed\n// and its result ID resolves when the client is persisted (EncodePersistedObject)\n// and reloaded.\nfunc (c *CurrentModuleAsSDKClient) AttachDependencyResults(\n\tctx context.Context,\n\t_ dagql.AnyResult,\n\tattach func(dagql.AnyResult) (dagql.AnyResult, error),\n) ([]dagql.AnyResult, error) {\n\t_ = ctx\n\tif c == nil || c.BoundWorkspace.Self() == nil {\n\t\treturn nil, nil\n\t}\n\tattached, err := attach(c.BoundWorkspace)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"attach bound workspace: %w\", err)\n\t}\n\ttyped, ok := attached.(dagql.ObjectResult[*Workspace])\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"attach bound workspace: unexpected result %T\", attached)\n\t}\n\tc.BoundWorkspace = typed\n\treturn []dagql.AnyResult{typed}, nil\n}\n","sourceCodeStart":180,"sourceCodeEnd":207,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/current_module_as_sdk.go#L180-L207","documentation":"During AttachDependencyResults for a module function call context, Dagger tried to attach the module's bound workspace and the underlying attach() call returned an error. The bound workspace object could not be re-attached to the current dagql server, so dependent results cannot be wired into the running function call. The root cause is wrapped in %w and typically comes from resolving/attaching the Workspace object.","triggerScenarios":"Calling a module function whose call context (CurrentModuleCallContext) has BoundWorkspace set, when attach(c.BoundWorkspace) fails — e.g. the workspace object reference cannot be resolved against the current dagql server (stale ID, wrong server instance, deleted object).","commonSituations":"Module SDK plumbing: a module function invoked with dependency results where the workspace was created in a prior/foreign session; IDs decoded against a different engine; internal regressions in the module runtime.","solutions":["Regenerate/rebuild the module and rerun with a fresh session to eliminate stale workspace IDs","Inspect the wrapped root error for the actual attach failure and address it (usually object resolution)","Update Dagger CLI and module SDK to matching versions","File a Dagger issue with the wrapped error and module repro if it persists on a fresh session"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Go module runtime\ndeps, err := callCtx.AttachDependencyResults(ctx)\nif err != nil {\n    if strings.Contains(err.Error(), \"attach bound workspace\") {\n        return nil, fmt.Errorf(\"workspace could not be re-attached; rerun in a fresh session: %w\", err)\n    }\n    return nil, err\n}","preventionTips":["Keep Dagger CLI and module SDK versions aligned","Avoid reusing module session IDs across engine restarts","Rebuild modules after upgrading Dagger"],"tags":["module","workspace","attach","sdk"],"backgroundTag":"workspace-attach-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"}