JuliusBrussee/caveman · error

githubapp: revoke token: HTTP %d: %s

Error message

githubapp: revoke token: HTTP %d: %s

What it means

Fires in RevokeToken() when the DELETE /installation/token call returns a non-success status. Revocation is best-effort — the token's ~1h natural expiry is the backstop — but the error surfaces so callers know agency was not dropped immediately.

Source

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

	if err := json.Unmarshal(raw, &out); err != nil {
		return InstallationToken{}, fmt.Errorf("githubapp: decode token response: %w", err)
	}
	if out.Token == "" {
		return InstallationToken{}, fmt.Errorf("githubapp: token response carried no token")
	}
	return out, nil
}

// RevokeToken DELETEs /installation/token authenticated with the token itself —
// the job-end "drop all agency" step. A best-effort revoke; the ~1h natural
// expiry is the backstop.
func (a *App) RevokeToken(ctx context.Context, token string) error {
	status, raw, err := a.do(ctx, "Bearer "+token, http.MethodDelete, "/installation/token", nil)
	if err != nil {
		return err
	}
	if status != http.StatusNoContent {
		return fmt.Errorf("githubapp: revoke token: HTTP %d: %s", status, snippet(raw))
	}
	return nil
}

// Repo is the minimal repo metadata the connect flow stores.
type Repo struct {
	ID            int64  `json:"id"`
	NodeID        string `json:"node_id"`
	FullName      string `json:"full_name"`
	DefaultBranch string `json:"default_branch"`
}

// GetRepo verifies that the installation token can see owner/name and returns the
// repo's stable node id + default branch. Used by select-repo to confirm the repo
// truly belongs to the installation before the binding goes 'active'.
func (a *App) GetRepo(ctx context.Context, token, owner, name string) (Repo, error) {
	status, raw, err := a.do(ctx, "Bearer "+token, http.MethodGet,
		"/repos/"+url.PathEscape(owner)+"/"+url.PathEscape(name), nil)

View on GitHub (pinned to 766dce6b13)

Solutions

  1. Log and rely on the ~1h token expiry as backstop; retry the revoke once
  2. Verify the token being revoked is a valid installation token
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at shared/platform/githubapp/githubapp.go:238 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/41abe549e2a43295. Report an issue: GitHub.