{"record":{"id":"7fb46cabf8ec36af","repo":"dagger/dagger","slug":"remote-workspace-q-w","errorCode":null,"errorMessage":"remote workspace %q: %w","messagePattern":"remote workspace %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/server/session_workspaces.go","lineNumber":368,"sourceCode":"\tif subdir == \"\" || subdir == \".\" {\n\t\treturn \".\", nil\n\t}\n\tif !filepath.IsLocal(subdir) {\n\t\treturn \"\", fmt.Errorf(\"path points outside repository: %q\", subdir)\n\t}\n\treturn subdir, nil\n}\n\n// loadWorkspaceFromRemote clones a git repo and detects/loads the workspace from it.\nfunc (srv *Server) loadWorkspaceFromRemote(ctx context.Context, client *daggerClient, remoteRef string) error {\n\tparsedRef, err := parseWorkspaceRemoteRef(ctx, remoteRef)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"remote workspace %q: parsing git ref: %w\", remoteRef, err)\n\t}\n\n\ttree, gitRef, err := srv.cloneGitTree(ctx, client.dag, parsedRef.cloneRef, parsedRef.version)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"remote workspace %q: %w\", remoteRef, err)\n\t}\n\n\tresolveLocalRef := func(ws *workspace.Workspace, relPath string) string {\n\t\tsubPath := filepath.Join(ws.Root, relPath)\n\t\treturn core.GitRefString(parsedRef.cloneRef, subPath, parsedRef.version)\n\t}\n\n\treturn srv.detectAndLoadWorkspaceWithRootfs(ctx, client,\n\t\t&core.DirectoryStatFS{Dir: tree},\n\t\tfunc(ctx context.Context, path string) ([]byte, error) {\n\t\t\treturn core.DirectoryReadFile(ctx, tree, path)\n\t\t},\n\t\tparsedRef.workspaceSubdir,\n\t\tresolveLocalRef,\n\t\tfunc(ws *workspace.Workspace) string {\n\t\t\treturn remoteWorkspaceAddress(parsedRef.cloneRef, ws.Cwd, parsedRef.version)\n\t\t},\n\t\tfalse, // isLocal","sourceCodeStart":350,"sourceCodeEnd":386,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/engine/server/session_workspaces.go#L350-L386","documentation":"loadWorkspaceFromRemote wraps any failure from srv.cloneGitTree while cloning the git tree for a remote workspace reference. The outer message names the workspace ref that failed; the inner error carries the actual cause (clone failure, bad version, network, auth). Dagger throws it whenever a remote workspace ref (e.g. passed to WithWorkspace or workspace loading) cannot be materialized from git.","triggerScenarios":"Calling loadWorkspaceFromRemote (via loadWorkspaceFromDeclaredRef) with a remote ref whose repo cannot be cloned: unknown or unreachable repo, non-existent branch/tag/version, network outage, or private repo without credentials.","commonSituations":"Typo in the git URL or ref, pinning a version that was force-deleted, CI runner without SSH keys/tokens for a private repo, offline environments, or a repo moved to a new host.","solutions":["Read the wrapped inner error to see whether it is auth, DNS, or a missing ref, and fix that specific cause.","Verify the ref with `git ls-remote <repo> <version>` from the same machine/container.","For private repos, ensure credentials (token, SSH key, or git credential helper) are available to the engine.","Pin to a commit SHA or an existing tag instead of a moving/renamed ref."],"exampleFix":"// before: pinned ref deleted upstream\nWithWorkspace(\"github.com/acme/widgets@v9.9.9\")\n// after: pin to an existing tag/SHA\nWithWorkspace(\"github.com/acme/widgets@v1.4.2\")","handlingStrategy":"retry","validationCode":"git ls-remote https://github.com/acme/widgets.git v1.4.2 || echo 'ref not reachable before calling the API'","typeGuard":null,"tryCatchPattern":"try {\n  await loadRemoteWorkspace(ref)\n} catch (e) {\n  if (/remote workspace .*:/.test(String(e))) {\n    // inspect wrapped cause; retry transient network errors with backoff,\n    // fail fast on auth or unknown-ref errors\n  }\n}","preventionTips":["Pin remote workspace refs to existing tags or commit SHAs, not moving branches.","Verify ref reachability with git ls-remote in CI before use.","Provide credentials for private repos to the engine/runner."],"tags":["git","remote-workspace","clone"],"backgroundTag":"git-clone-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"}