github/github-mcp-server · error
GitHub App installation ID is required (GITHUB_APP_INSTALLAT
Error message
GitHub App installation ID is required (GITHUB_APP_INSTALLATION_ID)
What it means
Thrown by the star_repository tool handler when deps.GetClient(ctx) fails before client.Activity.Star can run. In remote/server deployments (RequestDeps) the REST client is constructed per call from token info in the request context and configured API hosts; failure wraps 'no token info in context', 'failed to get base REST URL'/'failed to get upload URL', or 'failed to create REST client'. In stdio BaseDeps mode the prebuilt client is returned and this cannot fire.
Source
Thrown at internal/githubapp/githubapp.go:55
AppID string
// InstallationID identifies the installation whose access token is minted.
InstallationID string
// PrivateKeyPEM is the RSA key used to sign app JWTs.
PrivateKeyPEM []byte
// BaseRESTURL is the REST API base, e.g. https://api.github.com/ for
// github.com or https://HOST/api/v3/ for GitHub Enterprise Server.
BaseRESTURL string
}
func (c Config) validate() error {
switch {
case c.AppID == "":
return errors.New("GitHub App ID or client ID is required (GITHUB_APP_ID)")
case c.InstallationID == "":
return errors.New("GitHub App installation ID is required (GITHUB_APP_INSTALLATION_ID)")
case len(c.PrivateKeyPEM) == 0:
return errors.New("GitHub App private key is required (GITHUB_APP_PRIVATE_KEY_PATH or GITHUB_APP_PRIVATE_KEY)")
case c.BaseRESTURL == "":
return errors.New("GitHub App REST base URL is required")
}
return nil
}
func parsePrivateKey(pemBytes []byte) (*rsa.PrivateKey, error) {
block, _ := pem.Decode(pemBytes)
if block == nil {
return nil, errors.New("no PEM block found in private key")
}
if key, err := x509.ParsePKCS1PrivateKey(block.Bytes); err == nil {
return key, nil
}
parsed, err := x509.ParsePKCS8PrivateKey(block.Bytes)
if err != nil {View on GitHub (pinned to 0ea1f775a7)
Solutions
- Check the wrapped cause string to identify auth vs host-config failure
- Provide a valid token with 'user' scope (starring requires it) to the server
- Fix GITHUB_API_HOSTS / GITHUB_BASE_URL / GITHUB_UPLOAD_URL and restart
- Pre-flight with an authenticated read like get_me to fail before attempting writes
Example fix
// before: token absent from the runtime env // star_repository -> "failed to get GitHub client: no token info in context" // after export GITHUB_PERSONAL_ACCESS_TOKEN=ghp_xxxxxxxxxxxx # needs 'user' scope export GITHUB_API_HOSTS=api.github.com
Defensive patterns
Strategy: try-catch
Validate before calling
func preflightGitHubClient() error {
if os.Getenv("GITHUB_PERSONAL_ACCESS_TOKEN") == "" {
return fmt.Errorf("missing token: star_repository cannot build a client")
}
return nil
} Type guard
func isGitHubClientError(err error) bool {
return err != nil && strings.Contains(err.Error(), "failed to get GitHub client")
} Try / catch
result, _, err := callStarRepository(ctx, owner, repo)
if err != nil {
if isGitHubClientError(err) {
// config fault: verify token ('user' scope) and host env; do not retry
return fmt.Errorf("server auth/host misconfiguration: %w", err)
}
return err
} Prevention
- Ensure the token has 'user' scope for starring before scripting star jobs
- Pre-flight auth with get_me in the same pipeline
- Fail the whole batch early when the first call returns a client-construction error
- Never retry client-construction errors - they are deterministic until config changes
When it happens
Trigger: Calling star_repository when the request context lacks token info, when enterprise API host env vars are malformed so URL resolution fails, or when WithEnterpriseURLs rejects a non-absolute base/upload URL.
Common situations: Token env var missing or expired in CI where starring runs; proxy stripping Authorization; enterprise base URL typos like 'github.example.com' without scheme; deployment where env vars are set after process start.
Related errors
- GitHub App authentication and OAuth login (--oauth-client-id
- GitHub App REST base URL is required
- owner not specified
- owner is required
- failed to get GitHub client: %w
AI-assisted analysis of github/github-mcp-server@0ea1f775a7 (2026-08-15).
Data as JSON: /api/errors/051653cabb6ddc4b.
Report an issue: GitHub.