GoogleContainerTools/skaffold · error
failed to create repository manager client: %w
Error message
failed to create repository manager client: %w
What it means
GetRepoInfo resolves a Cloud Build (Artifact Registry) repository reference to its remote URI and access token. It first constructs a Repository Manager client via the RepositoryManagerClient function; if that client cannot be created (usually an auth or endpoint failure), it wraps the error with this message.
Source
Thrown at pkg/skaffold/gcbreposv2/repo_resolver.go:49
FetchReadToken(ctx context.Context, req *cloudbuildpb.FetchReadTokenRequest, opts ...gax.CallOption) (*cloudbuildpb.FetchReadTokenResponse, error)
Close() error
}
type Repo struct {
// Original repo URI.
URI string
// URI with oauth2 format.
CloneURI string
}
var RepositoryManagerClient = repositoryManagerClient
func GetRepoInfo(ctx context.Context, gcpProject, gcpRegion, gcpConnectionName, gcpRepoName string) (Repo, error) {
cbRepoRef := fmt.Sprintf("projects/%v/locations/%v/connections/%v/repositories/%v", gcpProject, gcpRegion, gcpConnectionName, gcpRepoName)
cbClient, err := RepositoryManagerClient(ctx)
if err != nil {
return Repo{}, fmt.Errorf("failed to create repository manager client: %w", err)
}
defer cbClient.Close()
repoURI, err := getRepoURI(ctx, cbClient, cbRepoRef)
if err != nil {
return Repo{}, fmt.Errorf("failed to get remote URI for repository %v: %w", gcpRepoName, err)
}
readAccessToken, err := getRepoReadAccessToken(ctx, cbClient, cbRepoRef)
if err != nil {
return Repo{}, fmt.Errorf("failed to get repository read access token for repo %v: %w", gcpRepoName, err)
}
repoCloneURI, err := buildRepoURIWithToken(repoURI, readAccessToken)
if err != nil {
return Repo{}, fmt.Errorf("failed to clone repo %s: trouble building repo URI with token: %w", repoURI, err)
}
View on GitHub (pinned to a1189de023)
Solutions
- Run `gcloud auth application-default login` or set GOOGLE_APPLICATION_CREDENTIALS to a valid service-account key.
- Verify network access to the Repository Manager API (repositorymanager.googleapis.com) from the environment.
- Check the wrapped cause (context deadline / credential / transport error) and fix it specifically.
- Retry if the failure was a transient network error or expired metadata-server token.
Example fix
// before (CI with no creds) $ skaffold ... # fails: failed to create repository manager client // after $ gcloud auth activate-service-account --key-file=$GOOGLE_APPLICATION_CREDENTIALS
Defensive patterns
Strategy: try-catch
Validate before calling
creds, err := google.FindDefaultCredentials(ctx, "https://www.googleapis.com/auth/cloud-platform")
if err != nil {
return fmt.Errorf("no GCP credentials available for repository manager: %w", err)
} Try / catch
repo, err := gcbreposv2.GetRepoInfo(ctx, proj, region, conn, name)
if err != nil && strings.Contains(err.Error(), "failed to create repository manager client") {
return fmt.Errorf("check gcloud auth / network to googleapis.com: %w", err)
} Prevention
- Set GOOGLE_APPLICATION_CREDENTIALS or run gcloud auth application-default login before invoking.
- Verify outbound access to repositorymanager.googleapis.com in CI.
- Keep contexts short-lived and free of pre-set deadlines when creating clients.
When it happens
Trigger: Calling GetRepoInfo when the repository manager client factory fails: missing/invalid Application Default Credentials, gcloud not authenticated, network failure reaching the Repository Manager API, or a bad context (canceled deadline).
Common situations: Running Skaffold in CI without a service account key or ADC configured; no network access to googleapis.com; the gcbreposv2 feature used on a machine with no gcloud login; project/region values pointing at an endpoint the credentials cannot access.
Related errors
- failed to get repository read access token for repo %v: %w
- error getting google authenticator
- failed to get remote URI for repository %v: %w
- failed to clone repo %s: trouble building repo URI with toke
- failed to get access token %v
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/fee07d3a054e0dab.
Report an issue: GitHub.