{"record":{"id":"41abe549e2a43295","repo":"JuliusBrussee/caveman","slug":"githubapp-revoke-token-http-d-s","errorCode":null,"errorMessage":"githubapp: revoke token: HTTP %d: %s","messagePattern":"githubapp: revoke token: HTTP (.+?): (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shared/platform/githubapp/githubapp.go","lineNumber":238,"sourceCode":"\tif err := json.Unmarshal(raw, &out); err != nil {\n\t\treturn InstallationToken{}, fmt.Errorf(\"githubapp: decode token response: %w\", err)\n\t}\n\tif out.Token == \"\" {\n\t\treturn InstallationToken{}, fmt.Errorf(\"githubapp: token response carried no token\")\n\t}\n\treturn out, nil\n}\n\n// RevokeToken DELETEs /installation/token authenticated with the token itself —\n// the job-end \"drop all agency\" step. A best-effort revoke; the ~1h natural\n// expiry is the backstop.\nfunc (a *App) RevokeToken(ctx context.Context, token string) error {\n\tstatus, raw, err := a.do(ctx, \"Bearer \"+token, http.MethodDelete, \"/installation/token\", nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif status != http.StatusNoContent {\n\t\treturn fmt.Errorf(\"githubapp: revoke token: HTTP %d: %s\", status, snippet(raw))\n\t}\n\treturn nil\n}\n\n// Repo is the minimal repo metadata the connect flow stores.\ntype Repo struct {\n\tID            int64  `json:\"id\"`\n\tNodeID        string `json:\"node_id\"`\n\tFullName      string `json:\"full_name\"`\n\tDefaultBranch string `json:\"default_branch\"`\n}\n\n// GetRepo verifies that the installation token can see owner/name and returns the\n// repo's stable node id + default branch. Used by select-repo to confirm the repo\n// truly belongs to the installation before the binding goes 'active'.\nfunc (a *App) GetRepo(ctx context.Context, token, owner, name string) (Repo, error) {\n\tstatus, raw, err := a.do(ctx, \"Bearer \"+token, http.MethodGet,\n\t\t\"/repos/\"+url.PathEscape(owner)+\"/\"+url.PathEscape(name), nil)","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/shared/platform/githubapp/githubapp.go#L220-L256","documentation":"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.","triggerScenarios":"Thrown at shared/platform/githubapp/githubapp.go:238 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Log and rely on the ~1h token expiry as backstop; retry the revoke once","Verify the token being revoked is a valid installation token"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"766dce6b1394ebb56a3090748d5a0240a5aefb36","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}