JuliusBrussee/caveman · error

githubapp: get installation: HTTP %d: %s

Error message

githubapp: get installation: HTTP %d: %s

What it means

Fires in GetInstallation() when GitHub returns a non-200 status for GET /app/installations/{id} — the id does not belong to this App, the App JWT is rejected, or GitHub is erroring. The message includes the status code and a body snippet for diagnosis.

Source

Thrown at shared/platform/githubapp/githubapp.go:172

}

// GetInstallation verifies an installation id against GitHub using the App JWT.
func (a *App) GetInstallation(ctx context.Context, installationID int64) (Installation, error) {
	var out Installation
	if installationID <= 0 {
		return out, fmt.Errorf("githubapp: installation id must be positive")
	}
	jwt, err := a.AppJWT()
	if err != nil {
		return out, err
	}
	status, raw, err := a.do(ctx, "Bearer "+jwt, http.MethodGet,
		"/app/installations/"+strconv.FormatInt(installationID, 10), nil)
	if err != nil {
		return out, err
	}
	if status != http.StatusOK {
		return out, fmt.Errorf("githubapp: get installation: HTTP %d: %s", status, snippet(raw))
	}
	if err := json.Unmarshal(raw, &out); err != nil {
		return out, fmt.Errorf("githubapp: decode installation: %w", err)
	}
	if out.ID != installationID || out.Account.ID <= 0 || strings.TrimSpace(out.Account.Login) == "" {
		return Installation{}, fmt.Errorf("githubapp: installation response identity mismatch")
	}
	return out, nil
}

// MintInstallationToken POSTs /app/installations/{id}/access_tokens narrowed to
// `repos` and `perms`, returning a ~1h token. Defaults (perms nil) are
// contents:write + pull_requests:write — enough to push a branch and open a draft
// PR, never to merge.
func (a *App) MintInstallationToken(ctx context.Context, installationID int64, repos []string, perms map[string]string) (InstallationToken, error) {
	if installationID <= 0 {
		return InstallationToken{}, fmt.Errorf("githubapp: installation id must be positive")
	}

View on GitHub (pinned to 766dce6b13)

Solutions

  1. Confirm the installation id belongs to this App (404 usually means it does not)
  2. Check the App JWT is fresh and the App is installed/enabled; retry on transient 5xx
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at shared/platform/githubapp/githubapp.go:172 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/72e34e4d02be2c80. Report an issue: GitHub.