{"record":{"id":"a5ba6c36b0b892d5","repo":"JuliusBrussee/caveman","slug":"githubapp-get-repo-s-s-http-d-s","errorCode":null,"errorMessage":"githubapp: get repo %s/%s: HTTP %d: %s","messagePattern":"githubapp: get repo (.+?)/(.+?): HTTP (.+?): (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shared/platform/githubapp/githubapp.go","lineNumber":261,"sourceCode":"// Repo is the minimal repo metadata the connect flow stores.\ntype Repo struct {\n\tID            int64  `json:\"id\"`\n\tNodeID        string `json:\"node_id\"`\n\tFullName      string `json:\"full_name\"`\n\tDefaultBranch string `json:\"default_branch\"`\n}\n\n// GetRepo verifies that the installation token can see owner/name and returns the\n// repo's stable node id + default branch. Used by select-repo to confirm the repo\n// truly belongs to the installation before the binding goes 'active'.\nfunc (a *App) GetRepo(ctx context.Context, token, owner, name string) (Repo, error) {\n\tstatus, raw, err := a.do(ctx, \"Bearer \"+token, http.MethodGet,\n\t\t\"/repos/\"+url.PathEscape(owner)+\"/\"+url.PathEscape(name), nil)\n\tif err != nil {\n\t\treturn Repo{}, err\n\t}\n\tif status != http.StatusOK {\n\t\treturn Repo{}, fmt.Errorf(\"githubapp: get repo %s/%s: HTTP %d: %s\", owner, name, status, snippet(raw))\n\t}\n\tvar r Repo\n\tif err := json.Unmarshal(raw, &r); err != nil {\n\t\treturn Repo{}, fmt.Errorf(\"githubapp: decode repo: %w\", err)\n\t}\n\treturn r, nil\n}\n\n// GetRepoInstallation asks GitHub which installation of this App owns access to\n// a repository. This avoids treating public repository visibility as proof that\n// a caller-supplied installation id is authorized for that repository.\nfunc (a *App) GetRepoInstallation(ctx context.Context, owner, name string) (Installation, error) {\n\tvar out Installation\n\tjwt, err := a.AppJWT()\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tstatus, raw, err := a.do(ctx, \"Bearer \"+jwt, http.MethodGet,","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/shared/platform/githubapp/githubapp.go#L243-L279","documentation":"GetRepo fetches repository metadata via GET /repos/{owner}/{name} with an installation token and expects HTTP 200. Any non-200 status produces this error carrying owner/name, status code, and a body snippet.","triggerScenarios":"GET /repos/... returns non-200: 404 if the App's installation lacks access to the repo, 401 for an expired installation token, 301/307 if the repo was renamed, 403 for blocked access.","commonSituations":"App installed on an org but the specific repo not selected during installation; token expired (installation tokens last ~1h); repo renamed or transferred between lookups.","solutions":["Check the embedded status: 404 means grant the App access to the repo in GitHub App installation settings","Refresh the installation token if 401 — installation tokens expire after about an hour","Verify owner/name spelling and that the repo hasn't been renamed or transferred","Retry on 5xx / 403-with-Retry-After (rate limit) after a backoff"],"exampleFix":"// before\nrepo, err := app.GetRepo(ctx, token, owner, name)\nif err != nil { return err }\n// after\nrepo, err := app.GetRepo(ctx, token, owner, name)\nif err != nil {\n    if strings.Contains(err.Error(), \"HTTP 404\") {\n        return fmt.Errorf(\"app not installed on %s/%s: %w\", owner, name, err)\n    }\n    return err\n}","handlingStrategy":"try-catch","validationCode":"// verify the installation has the repo selected before calling\n// (org-level check via GET /installation/repositories listing) or at minimum validate inputs\nif owner == \"\" || name == \"\" { return errors.New(\"owner/name required\") }","typeGuard":"func isRepoNotFound(err error) bool { return err != nil && strings.Contains(err.Error(), \"HTTP 404\") }","tryCatchPattern":"repo, err := app.GetRepo(ctx, token, owner, name)\nif err != nil {\n    if isRepoNotFound(err) { return fmt.Errorf(\"app lacks access to %s/%s\", owner, name) }\n    return err\n}","preventionTips":["Keep installation repo permissions up to date when adding repositories","Refresh installation tokens before operations that may run near the 1h expiry","Cache owner/name lookups but re-validate after renames/transfers","Log status code + snippet from the error for triage"],"tags":["github","http","repository"],"backgroundTag":"http-error-response","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}