{"record":{"id":"5a5cd7ce1a254fd9","repo":"dagger/dagger","slug":"workspace-cwd-w-5a5cd7","errorCode":null,"errorMessage":"workspace cwd: %w","messagePattern":"workspace cwd: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/dagger/workspace.go","lineNumber":592,"sourceCode":"\t}\n\tif err := updated.Export(ctx); err != nil {\n\t\treturn err\n\t}\n\t_, err = fmt.Fprintf(out, \"Uninstalled SDK %q from %s\\n\", name, configPath)\n\treturn err\n}\n\nfunc workspaceConfigHostPath(ctx context.Context, ws *dagger.Workspace) (string, error) {\n\tconfigFile, err := ws.ConfigFile(ctx)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"workspace config file: %w\", err)\n\t}\n\tif configFile == \"\" {\n\t\treturn \"\", fmt.Errorf(\"workspace config file is not selected\")\n\t}\n\tcwd, err := ws.Cwd(ctx)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"workspace cwd: %w\", err)\n\t}\n\tconfigFile, err = workspaceConfigRootPathFromCwd(configFile, cwd)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\troot, err := currentWorkspaceExportPath(ctx, ws)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn filepath.Join(root, filepath.FromSlash(configFile)), nil\n}\n\nfunc workspaceConfigRootPathFromCwd(configFile, cwd string) (string, error) {\n\tcwd, err := workspaceRelativeCwd(cwd)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tconfigFile = filepath.Clean(filepath.Join(cwd, filepath.FromSlash(configFile)))","sourceCodeStart":574,"sourceCodeEnd":610,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/internal/cmd/dagger/workspace.go#L574-L610","documentation":"workspaceConfigHostPath calls ws.Cwd(ctx) to learn the workspace's current working directory so the config file path can be made workspace-root-relative. If that engine call fails, the error is wrapped with this prefix and returned to all path-dependent workspace operations.","triggerScenarios":"Any install/uninstall SDK/module or env-write operation where the ws.Cwd() GraphQL call to the engine returns an error (engine failure, session terminated, workspace state unavailable).","commonSituations":"Engine session crashes mid-command, network/transport failure to the engine, or running against a remote engine where workspace cwd state cannot be fetched.","solutions":["Inspect the wrapped cause for the underlying engine error and fix that (e.g. reconnect the engine).","Re-run the command to get a fresh engine session.","Verify the engine is healthy (`dagger query` with a trivial query) before retrying workspace operations."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if _, err := ws.Cwd(ctx); err != nil {\n    // engine unreachable or session dead; reconnect before proceeding\n    return fmt.Errorf(\"engine unavailable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"path, err := workspaceConfigHostPath(ctx, ws)\nif err != nil {\n    if ctx.Err() != nil { return ctx.Err() }\n    return fmt.Errorf(\"workspace cwd lookup failed; reconnect the engine and retry: %w\", err)\n}","preventionTips":["Confirm engine connectivity with a trivial query before long workspace operations.","Set sane context timeouts so Cwd() failures are distinguishable from hangs.","Re-run the command once on transient engine errors before investigating."],"tags":["workspace","engine","cwd"],"backgroundTag":"workspace-cwd-unavailable","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"}