{"record":{"id":"ae968e7954391929","repo":"github/github-mcp-server","slug":"failed-to-read-readme-md-w","errorCode":null,"errorMessage":"failed to read README.md: %w","messagePattern":"failed to read README\\.md: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cmd/github-mcp-server/generate_docs.go","lineNumber":83,"sourceCode":"\t// keeps the legacy variants of tools gated by FeatureFlagDisable, so\n\t// flag-gated duplicates don't appear twice.\n\t// Build() can only fail if WithTools specifies invalid tools - not used here\n\tr, _ := github.NewInventory(t).\n\t\tWithToolsets([]string{\"all\"}).\n\t\tWithFeatureChecker(noFeatureFlagsChecker).\n\t\tBuild()\n\n\t// Generate toolsets documentation\n\ttoolsetsDoc := generateToolsetsDoc(r)\n\n\t// Generate tools documentation\n\ttoolsDoc := generateToolsDoc(r)\n\n\t// Read the current README.md\n\t// #nosec G304 - readmePath is controlled by command line flag, not user input\n\tcontent, err := os.ReadFile(readmePath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to read README.md: %w\", err)\n\t}\n\n\t// Replace toolsets section\n\tupdatedContent, err := replaceSection(string(content), \"START AUTOMATED TOOLSETS\", \"END AUTOMATED TOOLSETS\", toolsetsDoc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Replace tools section\n\tupdatedContent, err = replaceSection(updatedContent, \"START AUTOMATED TOOLS\", \"END AUTOMATED TOOLS\", toolsDoc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Write back to file\n\terr = os.WriteFile(readmePath, []byte(updatedContent), 0600)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to write README.md: %w\", err)","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/cmd/github-mcp-server/generate_docs.go#L65-L101","documentation":"Returned by generateReadmeDocs when os.ReadFile(readmePath) fails while regenerating README toolset/tool sections. readmePath defaults to README.md (relative to the working directory) or comes from a command-line flag; the read fails when the file is absent at that path or unreadable.","triggerScenarios":"Running generate-docs from any directory other than the repo root (README.md not found); passing a --readme flag pointing to a nonexistent file; README.md deleted in a stripped checkout; permission denial.","commonSituations":"Executing the generator via `go run ./cmd/github-mcp-server` from a subdirectory; CI checkouts that exclude README; typo'd custom path flag.","solutions":["cd to the repository root before running the docs generation command","Pass an absolute path via the command's path flag if running elsewhere","Confirm README.md exists and is readable (ls -l README.md)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if _, err := os.Stat(readmePath); err != nil {\n    log.Fatalf(\"README not found at %s — run from the repo root or pass --readme\", readmePath)\n}","typeGuard":null,"tryCatchPattern":"if err := generateReadmeDocs(readmePath); err != nil {\n    if os.IsNotExist(errors.Unwrap(err)) {\n        log.Fatalf(\"README.md missing at %q\", readmePath)\n    }\n    return err\n}","preventionTips":["Invoke generate-docs from the repository root","Pass an absolute path when running from elsewhere","Ensure CI checkouts include README.md"],"tags":["codegen","docs","readme","file-io"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}