JuliusBrussee/caveman · error
githubapp: get repository proof: HTTP
Error message
githubapp: get repository proof: HTTP %d: %s
What it means
GetFileContent requested the contents endpoint (GET /repos/{owner}/{name}/contents/{path}) with an installation token and received a non-200 status. The error carries the status code and a body snippet.
Solutions
- Check status: 404 → verify the file path, ref, and that the installation has access to the repo
- Refresh the installation token on 401; regenerate before long operations
- On 403 inspect X-RateLimit headers or use the Git blobs API for large files
- Fix the ref parameter to an existing branch, tag, or commit SHA (422)
Example fix
// before
b, err := app.GetFileContent(ctx, tok, owner, name, path, ref)
if err != nil { return err }
// after
b, err := app.GetFileContent(ctx, tok, owner, name, path, ref)
if err != nil {
if strings.Contains(err.Error(), "HTTP 404") {
return fmt.Errorf("proof file %s@%s not found or not accessible: %w", path, ref, err)
}
return err
} Defensive patterns
Strategy: retry
Validate before calling
// pre-check reachability of the file via the repo tree, and keep files <64KiB
if owner == "" || name == "" || path == "" { return errors.New("owner, name and path are required") } Type guard
func isNotFound(err error) bool { return err != nil && strings.Contains(err.Error(), "HTTP 404") }
func isRateLimited(err error) bool { return err != nil && strings.Contains(err.Error(), "HTTP 403") } Try / catch
var content []byte
var err error
for i := 0; i < 3; i++ {
content, err = app.GetFileContent(ctx, tok, owner, name, path, ref)
if err == nil || isNotFound(err) { break } // don't retry genuine 404s
time.Sleep(time.Duration(1<<i) * time.Second) // back off on 403/5xx
} Prevention
- Refresh installation tokens before long proof flows
- Verify ref (branch/tag/SHA) exists before fetching
- Remember the contents API rejects files >1MB — use the blobs API for big files
- Grant the installation access to every repo you will read
When it happens
Trigger: Non-200 from the contents endpoint: 404 when the file or repo is not visible to the installation, 401 for an expired token, 403 rate limit or file >1MB via contents API, 422 when ref is invalid.
Common situations: Requesting a file the App installation cannot see; file larger than the contents-API limit; wrong branch/tag passed as ref; token expired mid-workflow.
Understand the failure class
Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.
Related errors
- githubapp: build request
- githubapp: get repo / : HTTP
- githubapp: revoke token: HTTP
- awscreds: build sts request
- awscreds: : http
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/8e298dd24975fa36.
Report an issue: GitHub.
Appendix: source
Thrown at shared/platform/githubapp/githubapp.go:316
// 64 KiB post-decode ceiling because connection proofs are tiny text files.
func (a *App) GetFileContent(ctx context.Context, token, owner, name, path, ref string) ([]byte, error) {
segments := strings.Split(strings.Trim(path, "/"), "/")
if len(segments) == 0 || segments[0] == "" {
return nil, fmt.Errorf("githubapp: content path is required")
}
for i := range segments {
segments[i] = url.PathEscape(segments[i])
}
endpoint := "/repos/" + url.PathEscape(owner) + "/" + url.PathEscape(name) + "/contents/" + strings.Join(segments, "/")
if strings.TrimSpace(ref) != "" {
endpoint += "?" + url.Values{"ref": {ref}}.Encode()
}
status, raw, err := a.do(ctx, "Bearer "+token, http.MethodGet, endpoint, nil)
if err != nil {
return nil, err
}
if status != http.StatusOK {
return nil, fmt.Errorf("githubapp: get repository proof: HTTP %d: %s", status, snippet(raw))
}
var payload struct {
Type string `json:"type"`
Encoding string `json:"encoding"`
Content string `json:"content"`
Size int64 `json:"size"`
}
if err := json.Unmarshal(raw, &payload); err != nil {
return nil, fmt.Errorf("githubapp: decode repository proof: %w", err)
}
if payload.Type != "file" || payload.Encoding != "base64" || payload.Size < 0 || payload.Size > 64<<10 {
return nil, fmt.Errorf("githubapp: repository proof has invalid type, encoding, or size")
}
decoded, err := base64.StdEncoding.DecodeString(strings.ReplaceAll(payload.Content, "\n", ""))
if err != nil {
return nil, fmt.Errorf("githubapp: decode repository proof content: %w", err)
}
if len(decoded) > 64<<10 || int64(len(decoded)) != payload.Size {View on GitHub (pinned to 3ee70a1026)