dagger/dagger · error

lookup Cloud repository %s: %w

Error message

lookup Cloud repository %s: %w

What it means

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)).

Source

Thrown at internal/cmd/dagger/workspace.go:1363

			return source, true
		}
	}
	return cloudapi.MappedSource{}, false
}

func workspaceAutocheckClient(ctx context.Context, login bool) (*cloudapi.Client, error) {
	client, _, err := cloudCLI.cloudClientWithLogin(ctx, login)
	if err != nil {
		return nil, err
	}
	return client, nil
}

func findWorkspaceAutocheckState(ctx context.Context, client *cloudapi.Client, repo string) (workspaceAutocheckState, bool, error) {
	repo = "github.com/" + normalizeGitHubRepo(repo)
	repositories, err := client.UserRepositories(ctx, repo)
	if err != nil {
		return workspaceAutocheckState{}, false, fmt.Errorf("lookup Cloud repository %s: %w", repo, err)
	}
	repository, ok := workspaceRepositoryForRef(repositories, repo)
	if !ok {
		return workspaceAutocheckState{}, false, nil
	}
	state := workspaceAutocheckState{
		Repo:     repo,
		IsPublic: workspaceRepoIsPublic(repository.Settings),
	}
	if mapped := repository.MappedSource; mapped != nil {
		state.InstallationID = mapped.InstallationID
		state.SourceMode = mapped.Mode
		state.SelectedRepos, state.Enabled = workspaceSelectedRepos(mapped.Repositories, repo)
	}
	return state, true, nil
}

func workspaceRepositoryForRef(repositories []cloudapi.Repository, repo string) (cloudapi.Repository, bool) {

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Run 'dagger login' to refresh Cloud credentials.
  2. Check connectivity to the Dagger Cloud API (proxy, DNS, VPN) and retry.
  3. Confirm the repo argument is a valid github.com owner/slug reference.
  4. Read the wrapped cause to distinguish 401 (relogin), 403 (permissions), and 5xx (retry later) cases.

Example fix

// before: 'lookup Cloud repository github.com/acme/repo: unauthorized'
$ dagger login
// after: token refreshed and lookup succeeds
Defensive patterns

Strategy: retry

Validate before calling

// validate repo string format before lookup:
repoRe := regexp.MustCompile(`^github\.com/[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$`)
if !repoRe.MatchString("github.com/" + normalizeGitHubRepo(repo)) {
    return fmt.Errorf("invalid repo reference: %s", repo)
}

Try / catch

repos, err := client.UserRepositories(ctx, repo)
if err != nil {
    if isTransient(err) {
        return retry.WithBackoff(3, func() error { _, err = client.UserRepositories(ctx, repo); return err })
    }
    return fmt.Errorf("lookup Cloud repository %s: %w", repo, err)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05). Data as JSON: /api/errors/1f35f8c958b0a187. Report an issue: GitHub.