JuliusBrussee/caveman · error
githubapp: repo installation response carried no id
Error message
githubapp: repo installation response carried no id
What it means
The installation response parsed as JSON but the installation ID field was absent or non-positive (out.ID <= 0). The library treats an installation object without a valid id as unusable and rejects it defensively.
Solutions
- Inspect the raw response body — verify the JSON actually contains a positive numeric id
- Check whether a mock/test server is in play and fix its fixture to include id
- Update the Installation struct mapping if GitHub renamed/moved the id field
- Treat as an upstream contract violation and surface to the user — retry will not help
Example fix
// before
if out.ID <= 0 { return Installation{}, fmt.Errorf("githubapp: repo installation response carried no id") }
// after (fixture fix in mock server)
{"id": 12345, "app_id": 6789, ...} // mock must include a positive id Defensive patterns
Strategy: validation
Validate before calling
// when serving stub responses, always include a positive id
// assert on the parsed fixture before returning it
if fixture.ID <= 0 { t.Fatal("fixture missing installation id") } Type guard
func hasValidInstallationID(in githubapp.Installation) bool { return in.ID > 0 } Try / catch
inst, err := app.GetRepoInstallation(ctx, owner, name)
if err != nil || inst.ID <= 0 {
return fmt.Errorf("could not resolve installation for %s/%s: %w", owner, name, err)
} Prevention
- Keep mock-server fixtures complete (id must be positive)
- Watch for GitHub schema drift on the installation object
- Treat missing id as a contract violation — do not blind-retry
When it happens
Trigger: GitHub returns an installation-shaped JSON object whose id field is missing, null, zero, or negative — e.g. an unexpected payload variant or a stub/mock server returning incomplete data.
Common situations: Testing against a fake/mock GitHub server that omits the id field; GitHub API schema drift where the id moved or was renamed; caching layer returning partial objects.
Related errors
- githubapp: get repo installation
- githubapp: build request
- githubapp: content path is required
- githubapp: decode repo installation
- githubapp: decode repo
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/3c29636a105248f0.
Report an issue: GitHub.
Appendix: source
Thrown at shared/platform/githubapp/githubapp.go:291
func (a *App) GetRepoInstallation(ctx context.Context, owner, name string) (Installation, error) {
var out Installation
jwt, err := a.AppJWT()
if err != nil {
return out, err
}
status, raw, err := a.do(ctx, "Bearer "+jwt, http.MethodGet,
"/repos/"+url.PathEscape(owner)+"/"+url.PathEscape(name)+"/installation", nil)
if err != nil {
return out, err
}
if status != http.StatusOK {
return out, fmt.Errorf("githubapp: get repo installation %s/%s: HTTP %d: %s", owner, name, status, snippet(raw))
}
if err := json.Unmarshal(raw, &out); err != nil {
return out, fmt.Errorf("githubapp: decode repo installation: %w", err)
}
if out.ID <= 0 {
return Installation{}, fmt.Errorf("githubapp: repo installation response carried no id")
}
return out, nil
}
// GetFileContent reads one repository file with an installation token. The
// content endpoint returns base64; callers receive decoded bytes with a strict
// 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()View on GitHub (pinned to 3ee70a1026)