GoogleContainerTools/skaffold · error
failed to get remote URI for repository %v: %w
Error message
failed to get remote URI for repository %v: %w
What it means
After creating the Repository Manager client, GetRepoInfo calls getRepoURI to fetch the repository's remote URI (e.g. https://<region>-docker.pkg.dev/...). If that RPC fails, the error is wrapped with the repo name as 'failed to get remote URI'.
Source
Thrown at pkg/skaffold/gcbreposv2/repo_resolver.go:55
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)
}
return Repo{
URI: repoURI,
CloneURI: repoCloneURI,
}, nil
}
View on GitHub (pinned to a1189de023)
Solutions
- Verify project/region/connection/repo names against `gcloud builds connections` / Artifact Registry output.
- Grant the caller the viewer role on the Cloud Build connection and Artifact Registry repository.
- Check the wrapped cause: NOT_FOUND means wrong names, PERMISSION_DENIED means IAM, deadline means network.
- Confirm the repository still exists (it may have been deleted or renamed).
Example fix
// before gcbRepo: my-repo # wrong region default // after (verify actual location) gcloud builds connections describe my-connection --region=us-central1 # use matching region/connection in config
Defensive patterns
Strategy: validation
Validate before calling
// Verify repo/connection exists before calling GetRepoInfo
out, err := exec.Command("gcloud", "builds", "connections", "describe", conn,
"--region", region, "--project", proj).Output()
if err != nil {
return fmt.Errorf("connection %s not found in %s/%s", conn, proj, region)
} Try / catch
repo, err := gcbreposv2.GetRepoInfo(ctx, proj, region, conn, name)
if err != nil && strings.Contains(err.Error(), "failed to get remote URI") {
if strings.Contains(err.Error(), "404") || strings.Contains(err.Error(), "notFound") {
return fmt.Errorf("repo %q does not exist under %s/%s/%s", name, proj, region, conn)
}
return err
} Prevention
- Cross-check project/region/connection/repo names with `gcloud builds connections` output.
- Grant roles/cloudbuild.connectionViewer to the invoking identity.
- Keep skaffold.yaml repo references in sync with actual Artifact Registry repositories.
- Handle NOT_FOUND vs PERMISSION_DENIED vs DEADLINE differently when retrying.
When it happens
Trigger: Calling GetRepoInfo for a gcpRepoName that does not exist under the given project/region/connection, a mistyped connection or region, insufficient IAM permission (roles/cloudbuild.connectionViewer or viewer on the repo), or an API/network error.
Common situations: Typo in the repository or connection name in skaffold.yaml; using a repo from the wrong region; service account lacking Artifact Registry / Cloud Build connection read permissions; repo deleted while config still references it.
Related errors
- failed to create repository manager client: %w
- failed to get repository read access token for repo %v: %w
- failed to clone repo %s: trouble building repo URI with toke
- INIT_CLOUD_RUN_LOCATION_ERROR
- StatusCode_DEPLOY_CLOUD_RUN_GET_WORKER_POOL_ERR
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/640768f9a77d2044.
Report an issue: GitHub.