{"record":{"id":"26792f30bdf4262f","repo":"github/github-mcp-server","slug":"reading-github-app-private-key-file-w","errorCode":null,"errorMessage":"reading GitHub App private key file: %w","messagePattern":"reading GitHub App private key file: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/github-mcp-server/main.go","lineNumber":347,"sourceCode":"\n\tprovider, err := githubapp.NewProvider(githubapp.Config{\n\t\tAppID:          appID,\n\t\tInstallationID: installationID,\n\t\tPrivateKeyPEM:  keyBytes,\n\t\tBaseRESTURL:    restURL.String(),\n\t}, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to configure GitHub App authentication: %w\", err)\n\t}\n\treturn provider.AccessToken, nil\n}\n\nfunc loadAppPrivateKey(path, inline string) ([]byte, error) {\n\tswitch {\n\tcase path != \"\":\n\t\tdata, err := os.ReadFile(path) //#nosec G304 -- operator-supplied path to their own key\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"reading GitHub App private key file: %w\", err)\n\t\t}\n\t\treturn data, nil\n\tcase inline != \"\":\n\t\treturn []byte(strings.ReplaceAll(inline, `\\n`, \"\\n\")), nil\n\tdefault:\n\t\treturn nil, errors.New(\"GitHub App authentication requires a private key: set GITHUB_APP_PRIVATE_KEY_PATH (preferred) or GITHUB_APP_PRIVATE_KEY\")\n\t}\n}\n\nfunc wordSepNormalizeFunc(_ *pflag.FlagSet, name string) pflag.NormalizedName {\n\tfrom := []string{\"_\"}\n\tto := \"-\"\n\tfor _, sep := range from {\n\t\tname = strings.ReplaceAll(name, sep, to)\n\t}\n\treturn pflag.NormalizedName(name)\n}\n","sourceCodeStart":329,"sourceCodeEnd":365,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/cmd/github-mcp-server/main.go#L329-L365","documentation":"Error \"reading GitHub App private key file: %w\" thrown in github/github-mcp-server.","triggerScenarios":"Thrown at cmd/github-mcp-server/main.go:347 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}