JuliusBrussee/caveman · error
githubapp: decode repository proof: %w
Error message
githubapp: decode repository proof: %w
What it means
GetFileContent got a 200 from the contents endpoint but the JSON body did not decode into the type/encoding/content/size payload struct. The success response is not the documented file-content shape (e.g. a directory listing or an error page returned with 200).
Source
Thrown at shared/platform/githubapp/githubapp.go:325
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 {
return nil, fmt.Errorf("githubapp: repository proof size mismatch")
}
return decoded, nil
}
// DoToken issues an authenticated GitHub REST call with an installation token and
// returns the status + raw body for the caller to parse. It is the reusable
// primitive the worker's PR opener builds the Git Data API flow on, so every
// GitHub egress goes through the one SSRF-guarded client + fixed base host.View on GitHub (pinned to 766dce6b13)
Solutions
- Retry the request; inspect the raw body if persistent for API schema drift
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at shared/platform/githubapp/githubapp.go:325 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18).
Data as JSON: /api/errors/6b7bd21b3b338ed8.
Report an issue: GitHub.