{"record":{"id":"6d562d4e4575d561","repo":"github/github-mcp-server","slug":"failed-to-write-deprecated-aliases-docs-w","errorCode":null,"errorMessage":"failed to write deprecated aliases docs: %w","messagePattern":"failed to write deprecated aliases docs: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cmd/github-mcp-server/generate_docs.go","lineNumber":497,"sourceCode":"\t// Read the current file\n\tcontent, err := os.ReadFile(docsPath) //#nosec G304\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to read docs file: %w\", err)\n\t}\n\n\t// Generate the table\n\taliasesDoc := generateDeprecatedAliasesTable()\n\n\t// Replace content between markers\n\tupdatedContent, err := replaceSection(string(content), \"START AUTOMATED ALIASES\", \"END AUTOMATED ALIASES\", aliasesDoc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Write back to file\n\terr = os.WriteFile(docsPath, []byte(updatedContent), 0600)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to write deprecated aliases docs: %w\", err)\n\t}\n\n\treturn nil\n}\n\nfunc generateDeprecatedAliasesTable() string {\n\tvar buf strings.Builder\n\n\t// Add table header\n\tbuf.WriteString(\"| Old Name | New Name |\\n\")\n\tbuf.WriteString(\"|----------|----------|\\n\")\n\n\taliases := github.DeprecatedToolAliases\n\tif len(aliases) == 0 {\n\t\tbuf.WriteString(\"| *(none currently)* | |\")\n\t} else {\n\t\t// Sort keys for deterministic output\n\t\tvar oldNames []string","sourceCodeStart":479,"sourceCodeEnd":515,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/cmd/github-mcp-server/generate_docs.go#L479-L515","documentation":"Returned by generateDeprecatedAliasesDocs when the final os.WriteFile(docsPath, …, 0600) fails after successfully rebuilding the deprecated-aliases table between the markers. The generation logic completed; only persisting docs/tool-renaming.md failed.","triggerScenarios":"docs/tool-renaming.md (or the flag-provided path) is not writable: root-owned file in a CI container, read-only mount, directory in place of the file, or full disk.","commonSituations":"CI running as non-root against root-owned checkout; read-only bind mounts in containers; local runs where the file was chmod'ed 444.","solutions":["Ensure write permission on docs/tool-renaming.md (chmod u+w or fix ownership)","In CI, make the checkout writable or run the docs job as the owning user","Confirm the path targets a regular file on a writable volume"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if info, err := os.Stat(docsPath); err == nil && info.Mode().Perm()&0200 == 0 {\n    log.Fatalf(\"%s is read-only; chmod u+w before generating docs\", docsPath)\n}","typeGuard":null,"tryCatchPattern":"if err := generateDeprecatedAliasesDocs(docsPath); err != nil {\n    if errors.Is(err, fs.ErrPermission) || strings.Contains(err.Error(), \"failed to write deprecated aliases docs\") {\n        log.Fatalf(\"cannot write %s — fix ownership/permissions or the CI user\", docsPath)\n    }\n    return err\n}","preventionTips":["Ensure the docs file and its directory are writable by the generating process","In CI, run docs jobs as the checkout owner","Avoid read-only mounts for repositories used in codegen"],"tags":["codegen","docs","file-io","permissions","tool-renaming"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}