{"record":{"id":"572197f6aea10bb2","repo":"github/github-mcp-server","slug":"github-app-rest-base-url-is-required","errorCode":null,"errorMessage":"GitHub App REST base URL is required","messagePattern":"GitHub App REST base URL is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/githubapp/githubapp.go","lineNumber":59,"sourceCode":"\n\t// PrivateKeyPEM is the RSA key used to sign app JWTs.\n\tPrivateKeyPEM []byte\n\n\t// BaseRESTURL is the REST API base, e.g. https://api.github.com/ for\n\t// github.com or https://HOST/api/v3/ for GitHub Enterprise Server.\n\tBaseRESTURL string\n}\n\nfunc (c Config) validate() error {\n\tswitch {\n\tcase c.AppID == \"\":\n\t\treturn errors.New(\"GitHub App ID or client ID is required (GITHUB_APP_ID)\")\n\tcase c.InstallationID == \"\":\n\t\treturn errors.New(\"GitHub App installation ID is required (GITHUB_APP_INSTALLATION_ID)\")\n\tcase len(c.PrivateKeyPEM) == 0:\n\t\treturn errors.New(\"GitHub App private key is required (GITHUB_APP_PRIVATE_KEY_PATH or GITHUB_APP_PRIVATE_KEY)\")\n\tcase c.BaseRESTURL == \"\":\n\t\treturn errors.New(\"GitHub App REST base URL is required\")\n\t}\n\treturn nil\n}\n\nfunc parsePrivateKey(pemBytes []byte) (*rsa.PrivateKey, error) {\n\tblock, _ := pem.Decode(pemBytes)\n\tif block == nil {\n\t\treturn nil, errors.New(\"no PEM block found in private key\")\n\t}\n\tif key, err := x509.ParsePKCS1PrivateKey(block.Bytes); err == nil {\n\t\treturn key, nil\n\t}\n\tparsed, err := x509.ParsePKCS8PrivateKey(block.Bytes)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parsing private key (want PKCS#1 or PKCS#8 RSA): %w\", err)\n\t}\n\tkey, ok := parsed.(*rsa.PrivateKey)\n\tif !ok {","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/internal/githubapp/githubapp.go#L41-L77","documentation":"Thrown by the unstar_repository tool handler when deps.GetClient(ctx) fails before client.Activity.Unstar runs. In per-request deployments (RequestDeps) the client is built from token info in the context plus API host config, so the wrapped cause is 'no token info in context', 'failed to get base REST URL'/'failed to get upload URL', or 'failed to create REST client'. Stdio BaseDeps returns a stored client and cannot produce this error.","triggerScenarios":"Calling unstar_repository when no token info is present in the context, when enterprise host env vars are malformed, or when go-github rejects the configured URLs.","commonSituations":"Expired or missing GITHUB_PERSONAL_ACCESS_TOKEN; gateway not forwarding Authorization; enterprise URL misconfig after infrastructure migration.","solutions":["Read the wrapped cause to route the fix (auth vs host config)","Provide a valid token with 'user' scope to the server process/request","Correct API host env vars and restart","Smoke-test auth before running unstar workflows"],"exampleFix":"// before\n//   unstar_repository -> \"failed to get GitHub client: failed to get base REST URL: ...\"\nexport GITHUB_BASE_URL=\"github.example.com\"  # missing scheme\n\n// after\nexport GITHUB_BASE_URL=\"https://github.example.com\"\nexport GITHUB_PERSONAL_ACCESS_TOKEN=ghp_xxxxxxxxxxxx","handlingStrategy":"try-catch","validationCode":"func preflightGitHubClient() error {\n\tif os.Getenv(\"GITHUB_PERSONAL_ACCESS_TOKEN\") == \"\" {\n\t\treturn fmt.Errorf(\"missing token: unstar_repository cannot build a client\")\n\t}\n\treturn nil\n}","typeGuard":"func isGitHubClientError(err error) bool {\n\treturn err != nil && strings.Contains(err.Error(), \"failed to get GitHub client\")\n}","tryCatchPattern":"result, _, err := callUnstarRepository(ctx, owner, repo)\nif err != nil {\n\tif isGitHubClientError(err) {\n\t\t// deterministic config fault: fix token/host env, restart, then re-run\n\t\treturn fmt.Errorf(\"server auth/host misconfiguration: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Check enterprise URL env vars include the scheme (https://)","Re-verify tokens after infrastructure migrations","Smoke-test with get_me before unstar workflows","Alert on client-construction errors instead of retrying them"],"tags":["go","github","authentication","configuration"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}