{"record":{"id":"640768f9a77d2044","repo":"GoogleContainerTools/skaffold","slug":"failed-to-get-remote-uri-for-repository-v-w","errorCode":null,"errorMessage":"failed to get remote URI for repository %v: %w","messagePattern":"failed to get remote URI for repository (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/gcbreposv2/repo_resolver.go","lineNumber":55,"sourceCode":"\tURI string\n\n\t// URI with oauth2 format.\n\tCloneURI string\n}\n\nvar RepositoryManagerClient = repositoryManagerClient\n\nfunc GetRepoInfo(ctx context.Context, gcpProject, gcpRegion, gcpConnectionName, gcpRepoName string) (Repo, error) {\n\tcbRepoRef := fmt.Sprintf(\"projects/%v/locations/%v/connections/%v/repositories/%v\", gcpProject, gcpRegion, gcpConnectionName, gcpRepoName)\n\tcbClient, err := RepositoryManagerClient(ctx)\n\tif err != nil {\n\t\treturn Repo{}, fmt.Errorf(\"failed to create repository manager client: %w\", err)\n\t}\n\tdefer cbClient.Close()\n\n\trepoURI, err := getRepoURI(ctx, cbClient, cbRepoRef)\n\tif err != nil {\n\t\treturn Repo{}, fmt.Errorf(\"failed to get remote URI for repository %v: %w\", gcpRepoName, err)\n\t}\n\n\treadAccessToken, err := getRepoReadAccessToken(ctx, cbClient, cbRepoRef)\n\tif err != nil {\n\t\treturn Repo{}, fmt.Errorf(\"failed to get repository read access token for repo %v: %w\", gcpRepoName, err)\n\t}\n\n\trepoCloneURI, err := buildRepoURIWithToken(repoURI, readAccessToken)\n\tif err != nil {\n\t\treturn Repo{}, fmt.Errorf(\"failed to clone repo %s: trouble building repo URI with token: %w\", repoURI, err)\n\t}\n\n\treturn Repo{\n\t\tURI:      repoURI,\n\t\tCloneURI: repoCloneURI,\n\t}, nil\n}\n","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/gcbreposv2/repo_resolver.go#L37-L73","documentation":"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'.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":"// before\ngcbRepo: my-repo  # wrong region default\n// after (verify actual location)\ngcloud builds connections describe my-connection --region=us-central1\n# use matching region/connection in config","handlingStrategy":"validation","validationCode":"// Verify repo/connection exists before calling GetRepoInfo\nout, err := exec.Command(\"gcloud\", \"builds\", \"connections\", \"describe\", conn,\n    \"--region\", region, \"--project\", proj).Output()\nif err != nil {\n    return fmt.Errorf(\"connection %s not found in %s/%s\", conn, proj, region)\n}","typeGuard":null,"tryCatchPattern":"repo, err := gcbreposv2.GetRepoInfo(ctx, proj, region, conn, name)\nif err != nil && strings.Contains(err.Error(), \"failed to get remote URI\") {\n    if strings.Contains(err.Error(), \"404\") || strings.Contains(err.Error(), \"notFound\") {\n        return fmt.Errorf(\"repo %q does not exist under %s/%s/%s\", name, proj, region, conn)\n    }\n    return err\n}","preventionTips":["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."],"tags":["gcp","cloud-build","rpc","iam"],"backgroundTag":"google-api-not-found","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}