{"record":{"id":"8e298dd24975fa36","repo":"JuliusBrussee/caveman","slug":"githubapp-get-repository-proof-http-d-s","errorCode":null,"errorMessage":"githubapp: get repository proof: HTTP %d: %s","messagePattern":"githubapp: get repository proof: HTTP (.+?): (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shared/platform/githubapp/githubapp.go","lineNumber":316,"sourceCode":"// 64 KiB post-decode ceiling because connection proofs are tiny text files.\nfunc (a *App) GetFileContent(ctx context.Context, token, owner, name, path, ref string) ([]byte, error) {\n\tsegments := strings.Split(strings.Trim(path, \"/\"), \"/\")\n\tif len(segments) == 0 || segments[0] == \"\" {\n\t\treturn nil, fmt.Errorf(\"githubapp: content path is required\")\n\t}\n\tfor i := range segments {\n\t\tsegments[i] = url.PathEscape(segments[i])\n\t}\n\tendpoint := \"/repos/\" + url.PathEscape(owner) + \"/\" + url.PathEscape(name) + \"/contents/\" + strings.Join(segments, \"/\")\n\tif strings.TrimSpace(ref) != \"\" {\n\t\tendpoint += \"?\" + url.Values{\"ref\": {ref}}.Encode()\n\t}\n\tstatus, raw, err := a.do(ctx, \"Bearer \"+token, http.MethodGet, endpoint, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif status != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"githubapp: get repository proof: HTTP %d: %s\", status, snippet(raw))\n\t}\n\tvar payload struct {\n\t\tType     string `json:\"type\"`\n\t\tEncoding string `json:\"encoding\"`\n\t\tContent  string `json:\"content\"`\n\t\tSize     int64  `json:\"size\"`\n\t}\n\tif err := json.Unmarshal(raw, &payload); err != nil {\n\t\treturn nil, fmt.Errorf(\"githubapp: decode repository proof: %w\", err)\n\t}\n\tif payload.Type != \"file\" || payload.Encoding != \"base64\" || payload.Size < 0 || payload.Size > 64<<10 {\n\t\treturn nil, fmt.Errorf(\"githubapp: repository proof has invalid type, encoding, or size\")\n\t}\n\tdecoded, err := base64.StdEncoding.DecodeString(strings.ReplaceAll(payload.Content, \"\\n\", \"\"))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"githubapp: decode repository proof content: %w\", err)\n\t}\n\tif len(decoded) > 64<<10 || int64(len(decoded)) != payload.Size {","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/shared/platform/githubapp/githubapp.go#L298-L334","documentation":"Fires in GetFileContent() when GET on the contents endpoint returns non-200 — the file does not exist at that ref, the installation token lacks access, or the repo/owner is wrong. Used for connection-proof retrieval (tiny text files).","triggerScenarios":"Thrown at shared/platform/githubapp/githubapp.go:316 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the proof file exists at the given path and ref (404 means missing)","Check the installation token grants contents read access; retry on transient 5xx"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"766dce6b1394ebb56a3090748d5a0240a5aefb36","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}