{"record":{"id":"1f35f8c958b0a187","repo":"dagger/dagger","slug":"lookup-cloud-repository-s-w","errorCode":null,"errorMessage":"lookup Cloud repository %s: %w","messagePattern":"lookup Cloud repository (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/dagger/workspace.go","lineNumber":1363,"sourceCode":"\t\t\treturn source, true\n\t\t}\n\t}\n\treturn cloudapi.MappedSource{}, false\n}\n\nfunc workspaceAutocheckClient(ctx context.Context, login bool) (*cloudapi.Client, error) {\n\tclient, _, err := cloudCLI.cloudClientWithLogin(ctx, login)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client, nil\n}\n\nfunc findWorkspaceAutocheckState(ctx context.Context, client *cloudapi.Client, repo string) (workspaceAutocheckState, bool, error) {\n\trepo = \"github.com/\" + normalizeGitHubRepo(repo)\n\trepositories, err := client.UserRepositories(ctx, repo)\n\tif err != nil {\n\t\treturn workspaceAutocheckState{}, false, fmt.Errorf(\"lookup Cloud repository %s: %w\", repo, err)\n\t}\n\trepository, ok := workspaceRepositoryForRef(repositories, repo)\n\tif !ok {\n\t\treturn workspaceAutocheckState{}, false, nil\n\t}\n\tstate := workspaceAutocheckState{\n\t\tRepo:     repo,\n\t\tIsPublic: workspaceRepoIsPublic(repository.Settings),\n\t}\n\tif mapped := repository.MappedSource; mapped != nil {\n\t\tstate.InstallationID = mapped.InstallationID\n\t\tstate.SourceMode = mapped.Mode\n\t\tstate.SelectedRepos, state.Enabled = workspaceSelectedRepos(mapped.Repositories, repo)\n\t}\n\treturn state, true, nil\n}\n\nfunc workspaceRepositoryForRef(repositories []cloudapi.Repository, repo string) (cloudapi.Repository, bool) {","sourceCodeStart":1345,"sourceCodeEnd":1381,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/internal/cmd/dagger/workspace.go#L1345-L1381","documentation":"findWorkspaceAutocheckState normalizes the repo to 'github.com/<owner>/<slug>' and calls client.UserRepositories. Any error from that Cloud API call is wrapped as 'lookup Cloud repository %s: %w'. This is a transport/auth/API failure during repo lookup, not the benign not-found case (which returns (state, false, nil)).","triggerScenarios":"client.UserRepositories(ctx, repo) errors: invalid Cloud session token, unreachable Cloud API, malformed repo string causing an API-side rejection, or a 4xx/5xx response.","commonSituations":"Running 'dagger' workspace commands offline or behind a corporate proxy; expired dagger login; repo string with unexpected formatting that Cloud can't resolve; Cloud API incident.","solutions":["Run 'dagger login' to refresh Cloud credentials.","Check connectivity to the Dagger Cloud API (proxy, DNS, VPN) and retry.","Confirm the repo argument is a valid github.com owner/slug reference.","Read the wrapped cause to distinguish 401 (relogin), 403 (permissions), and 5xx (retry later) cases."],"exampleFix":"// before: 'lookup Cloud repository github.com/acme/repo: unauthorized'\n$ dagger login\n// after: token refreshed and lookup succeeds","handlingStrategy":"retry","validationCode":"// validate repo string format before lookup:\nrepoRe := regexp.MustCompile(`^github\\.com/[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$`)\nif !repoRe.MatchString(\"github.com/\" + normalizeGitHubRepo(repo)) {\n    return fmt.Errorf(\"invalid repo reference: %s\", repo)\n}","typeGuard":null,"tryCatchPattern":"repos, err := client.UserRepositories(ctx, repo)\nif err != nil {\n    if isTransient(err) {\n        return retry.WithBackoff(3, func() error { _, err = client.UserRepositories(ctx, repo); return err })\n    }\n    return fmt.Errorf(\"lookup Cloud repository %s: %w\", repo, err)\n}","preventionTips":["Normalize the repo slug before lookup so Cloud sees the expected form.","Treat not-found (ok=false) as a normal outcome; only errors need handling.","Keep the Cloud session fresh and handle offline scenarios gracefully."],"tags":["cloud","api-error","network","cli"],"backgroundTag":"cloud-api-call-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"}