{"record":{"id":"454a489c722c8ef9","repo":"dagger/dagger","slug":"resolve-workspace-q-w","errorCode":null,"errorMessage":"resolve workspace %q: %w","messagePattern":"resolve workspace %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/dagger/sdk_init_dynamic.go","lineNumber":321,"sourceCode":"\troot, ok, err := sdkInitConfigSearchRoot()\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\tif !ok {\n\t\treturn nil, \"\", nil\n\t}\n\n\treturn readWorkspaceConfigForSDKInitRegistrationFrom(root)\n}\n\nfunc sdkInitConfigSearchRoot() (string, bool, error) {\n\tif workspaceRef != \"\" {\n\t\tif isObviouslyRemoteWorkspaceRef(workspaceRef) {\n\t\t\treturn \"\", false, nil\n\t\t}\n\t\tabs, err := pathutil.Abs(workspaceRef)\n\t\tif err != nil {\n\t\t\treturn \"\", false, fmt.Errorf(\"resolve workspace %q: %w\", workspaceRef, err)\n\t\t}\n\t\treturn abs, true, nil\n\t}\n\n\tcwd, err := os.Getwd()\n\tif err != nil {\n\t\treturn \"\", false, fmt.Errorf(\"getwd: %w\", err)\n\t}\n\treturn cwd, true, nil\n}\n\nfunc readWorkspaceConfigForSDKInitRegistrationFrom(start string) (*workspace.Config, string, error) {\n\tdir := start\n\tfor {\n\t\tcfgPath := filepath.Join(dir, workspace.ConfigFileName)\n\t\tif _, err := os.Stat(cfgPath); err == nil {\n\t\t\tdata, err := os.ReadFile(cfgPath)\n\t\t\tif err != nil {","sourceCodeStart":303,"sourceCodeEnd":339,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/internal/cmd/dagger/sdk_init_dynamic.go#L303-L339","documentation":"Wraps a pathutil.Abs failure in sdkInitConfigSearchRoot when converting a user-supplied workspace reference to an absolute path. This only happens for non-remote (local) workspace refs whose path cannot be made absolute.","triggerScenarios":"Passing `--workspace <ref>` (or similar) with a local path string that pathutil.Abs rejects — typically an unresolvable/empty-ish malformed path that isn't caught by the remote-ref check.","commonSituations":"Malformed --workspace flag value; unusual path characters; environment where path resolution fails.","solutions":["Pass a valid local directory path or omit the flag to use the current working directory","Use a remote ref (e.g. git URL) if you meant a remote workspace — those skip this path resolution","Quote the path in your shell to avoid it being mangled"],"exampleFix":"// before\n$ dagger sdk init py --workspace \"\"\n// after\n$ dagger sdk init py --workspace /path/to/workspace","handlingStrategy":"validation","validationCode":"[ -d \"$WORKSPACE_REF\" ] || [ \"$WORKSPACE_REF\" =~ ^(https?|git|ssh):// ] || echo \"--workspace must be a valid local dir or remote ref\"","typeGuard":null,"tryCatchPattern":"if err != nil && strings.HasPrefix(err.Error(), \"resolve workspace\") { return fmt.Errorf(\"bad --workspace value: %w\", err) }","preventionTips":["Quote workspace paths in the shell","Use absolute local paths or recognized remote refs","Omit --workspace to rely on the current directory"],"tags":["cli","path","workspace"],"backgroundTag":"invalid-path","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"}