github/github-mcp-server · warning

failed to read docs file: %w

Error message

failed to read docs file: %w

What it means

Returned by generateRemoteServerDocs when os.ReadFile(docsPath) fails, where docsPath is docs/remote-server.md (or the configured path). The generator reads the file to splice generated toolset tables between AUTOMATED markers; a missing or unreadable file aborts with this wrapped error.

Source

Thrown at cmd/github-mcp-server/generate_docs.go:110

	// Replace tools section
	updatedContent, err = replaceSection(updatedContent, "START AUTOMATED TOOLS", "END AUTOMATED TOOLS", toolsDoc)
	if err != nil {
		return err
	}

	// Write back to file
	err = os.WriteFile(readmePath, []byte(updatedContent), 0600)
	if err != nil {
		return fmt.Errorf("failed to write README.md: %w", err)
	}

	return nil
}

func generateRemoteServerDocs(docsPath string) error {
	content, err := os.ReadFile(docsPath) //#nosec G304
	if err != nil {
		return fmt.Errorf("failed to read docs file: %w", err)
	}

	toolsetsDoc := generateRemoteToolsetsDoc()

	// Replace content between markers
	updatedContent, err := replaceSection(string(content), "START AUTOMATED TOOLSETS", "END AUTOMATED TOOLSETS", toolsetsDoc)
	if err != nil {
		return err
	}

	// Also generate remote-only toolsets section
	remoteOnlyDoc := generateRemoteOnlyToolsetsDoc()
	updatedContent, err = replaceSection(updatedContent, "START AUTOMATED REMOTE TOOLSETS", "END AUTOMATED REMOTE TOOLSETS", remoteOnlyDoc)
	if err != nil {
		return err
	}

	return os.WriteFile(docsPath, []byte(updatedContent), 0600) //#nosec G306

View on GitHub (pinned to 0ea1f775a7)

Solutions

  1. Run the command from the repository root
  2. Confirm docs/remote-server.md exists (restore from git if deleted: git checkout -- docs/remote-server.md)
  3. Fix read permissions if applicable
Defensive patterns

Strategy: try-catch

Validate before calling

if _, err := os.Stat("docs/remote-server.md"); err != nil {
    log.Fatalf("docs/remote-server.md missing — run generate-docs from the repo root")
}

Try / catch

if err := generateRemoteServerDocs(docsPath); err != nil {
    if os.IsNotExist(errors.Unwrap(err)) {
        log.Fatalf("%s not found; restore it (git checkout -- docs/remote-server.md) or fix cwd", docsPath)
    }
    return err
}

Prevention

When it happens

Trigger: Running generate-docs outside the repo root so docs/remote-server.md does not resolve; the file was deleted/renamed during docs restructure; permission denial; custom path flag pointing nowhere.

Common situations: Subdirectory invocations of the codegen command; forks predating the file's introduction; CI sparse checkouts lacking docs/.

Related errors


AI-assisted analysis of github/github-mcp-server@0ea1f775a7 (2026-08-15). Data as JSON: /api/errors/e9c000fcb984ce0f. Report an issue: GitHub.