{"record":{"id":"5d102c9c971941cc","repo":"github/copilot-sdk","slug":"missing-github-token-acquire-request","errorCode":null,"errorMessage":"missing GitHub token acquire request","messagePattern":"missing GitHub token acquire request","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/client.go","lineNumber":2583,"sourceCode":"\toperation.mutex.Lock()\n\treturn func() {\n\t\toperation.mutex.Unlock()\n\t\tc.sessionOperationsMux.Lock()\n\t\toperation.users--\n\t\tif operation.users == 0 {\n\t\t\tdelete(c.sessionOperations, sessionID)\n\t\t}\n\t\tc.sessionOperationsMux.Unlock()\n\t}\n}\n\ntype gitHubTokenAdapter struct {\n\tclient *Client\n}\n\nfunc (a *gitHubTokenAdapter) GetToken(request *rpc.GitHubTokenAcquireRequest) (rpc.GitHubTokenAcquireResult, error) {\n\tif request == nil {\n\t\treturn nil, fmt.Errorf(\"missing GitHub token acquire request\")\n\t}\n\ta.client.gitHubTokenProvidersMux.RLock()\n\tprovider := a.client.gitHubTokenProviders[request.RegistrationID]\n\ta.client.gitHubTokenProvidersMux.RUnlock()\n\tif provider == nil {\n\t\treturn nil, fmt.Errorf(\"unknown GitHub token provider registration ID %q\", request.RegistrationID)\n\t}\n\n\tresult, err := provider(GitHubTokenProviderArgs{\n\t\tHost:      request.Host,\n\t\tSessionID: request.SessionID,\n\t\tReason:    request.Reason,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif result != nil && result.Cancelled {\n\t\treturn &rpc.GitHubTokenAcquireResultCancelled{}, nil","sourceCodeStart":2565,"sourceCodeEnd":2601,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/client.go#L2565-L2601","documentation":"Returned by gitHubTokenAdapter.GetToken when the JSON-RPC layer delivers a nil GitHubTokenAcquireRequest. The adapter cannot look up a provider without a registration ID, so it rejects the call immediately instead of panicking on a nil dereference.","triggerScenarios":"The CLI server sends a github token acquire callback with a null/absent request payload, invoking gitHubTokenAdapter.GetToken(nil).","commonSituations":"Protocol/version mismatch where the peer sends an empty params object; a serialization bug on the CLI side; manually constructed RPC calls omitting the request body.","solutions":["Upgrade CLI and SDK to matching versions so the acquire request is always serialized with the payload.","Check for a bug in the caller constructing the request; ensure the JSON-RPC params object is populated.","Inspect the peer's logs to see why an empty request was dispatched."],"exampleFix":"// before\nadapter := &gitHubTokenAdapter{client: c} // nil requests surface as this error\n\n// after\nfunc (a *gitHubTokenAdapter) GetToken(req *rpc.GitHubTokenAcquireRequest) (rpc.GitHubTokenAcquireResult, error) {\n    if req == nil {\n        return nil, fmt.Errorf(\"missing GitHub token acquire request\")\n    }\n    // proceed\n    return a.GetTokenChecked(req)\n}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"func validAcquireRequest(r *rpc.GitHubTokenAcquireRequest) bool { return r != nil && r.RegistrationID != \"\" }","tryCatchPattern":"if err != nil {\n    if strings.Contains(err.Error(), \"missing GitHub token acquire request\") {\n        // peer sent empty payload; log and check protocol versions\n    }\n    return err\n}","preventionTips":["Keep SDK and CLI versions in sync.","Never dispatch acquire callbacks with a nil request; validate payloads at the RPC boundary."],"tags":["github","token","null-argument","rpc","go"],"backgroundTag":"null-argument","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}