{"record":{"id":"82a0102050a46410","repo":"github/github-mcp-server","slug":"failed-to-open-log-file-w","errorCode":null,"errorMessage":"failed to open log file: %w","messagePattern":"failed to open log file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/ghmcp/server.go","lineNumber":293,"sourceCode":"\t\t\tauthModes++\n\t\t}\n\t}\n\tif authModes > 1 {\n\t\treturn fmt.Errorf(\"choose exactly one authentication mode: a static Token, OAuthManager, or TokenProvider\")\n\t}\n\n\t// Create app context\n\tctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)\n\tdefer stop()\n\n\tt, dumpTranslations := translations.TranslationHelper()\n\n\tvar slogHandler slog.Handler\n\tvar logOutput io.Writer\n\tif cfg.LogFilePath != \"\" {\n\t\tfile, err := os.OpenFile(cfg.LogFilePath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0600)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to open log file: %w\", err)\n\t\t}\n\t\tlogOutput = file\n\t\tslogHandler = slog.NewTextHandler(logOutput, &slog.HandlerOptions{Level: slog.LevelDebug})\n\t} else {\n\t\tlogOutput = os.Stderr\n\t\tslogHandler = slog.NewTextHandler(logOutput, &slog.HandlerOptions{Level: slog.LevelInfo})\n\t}\n\tlogger := slog.New(slogHandler)\n\tlogger.Info(\"starting server\", \"version\", cfg.Version, \"host\", cfg.Host, \"readOnly\", cfg.ReadOnly, \"lockdownEnabled\", cfg.LockdownMode)\n\n\t// Determine the scope set used to filter tools. Classic PATs expose their\n\t// granted scopes via the API; OAuth uses the requested scopes (the default\n\t// set hides nothing, a narrower explicit set filters accordingly). Other\n\t// token types don't advertise scopes, so filtering is skipped.\n\tvar tokenScopes []string\n\tswitch {\n\tcase strings.HasPrefix(cfg.Token, \"ghp_\"):\n\t\tfetchedScopes, err := fetchTokenScopesForHost(ctx, cfg.Token, cfg.Host)","sourceCodeStart":275,"sourceCodeEnd":311,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/internal/ghmcp/server.go#L275-L311","documentation":"Error \"failed to open log file: %w\" thrown in github/github-mcp-server.","triggerScenarios":"Thrown at internal/ghmcp/server.go:293 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-16T03:17:38.424Z"}