Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

bug(doctor): an empty ~/.gemini/config/mcp_config.json fails doctor with mcp_inspection_error and skips every other adapter

Open Beginner friendly
#1,899 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go
Domain
cli

Research direction

The parse failure comes from StaleMCPCommands() in internal/setup/registry.go, which skips only os.IsNotExist before calling json.Unmarshal on the file contents. Read that loop, then reproduce with the steps in the issue: an empty or whitespace-only ~/.gemini/config/mcp_config.json should behave like an absent file. Done means that case no longer returns an error, {} behaves as before, and other adapters still get inspected.

Written by the indexing model from the issue text.

Description

Existing Issue Search
  • I searched existing issues and will add evidence to a canonical tracker when applicable.
📝 Observed Consequence

engram doctor reports an error status (mcp_inspection_error) when ~/.gemini/config/mcp_config.json exists but is empty (0 bytes) or whitespace-only. The same machine reports ok when the file is absent or contains {}.

Because setup.StaleMCPCommands() returns on the first parse failure, the empty file also aborts the stale-MCP-command inspection for every other agent adapter, so one unrelated empty file hides any real finding in other clients' configs.

An empty file at that path is a realistic state: an Antigravity install/migration left a 0-byte mcp_config.json on my machine, and nothing had registered an MCP server there yet.

🔄 Steps to Reproduce
  1. Use an isolated home and data dir: T=$(mktemp -d); mkdir -p "$T/home/.gemini/config" "$T/data"
  2. Create one memory so the store exists: HOME="$T/home" ENGRAM_DATA_DIR="$T/data" engram save probe "probe body" --project probe
  3. Run HOME="$T/home" ENGRAM_DATA_DIR="$T/data" engram doctor --json | jq -r .status → ok (file absent)
  4. Run : > "$T/home/.gemini/config/mcp_config.json" and repeat step 3 → error
  5. Run printf ' \n' > "$T/home/.gemini/config/mcp_config.json" and repeat step 3 → error
  6. Run echo '{}' > "$T/home/.gemini/config/mcp_config.json" and repeat step 3 → ok
✅ Expected Behavior

An empty or whitespace-only MCP config file is treated like an absent one (no registrations to inspect), the same as {}. Doctor stays ok, and the remaining adapters are still inspected.

❌ Actual Behavior
[error] mcp_inspection_error — Could not inspect generic MCP registrations: parse <tmp>/home/.gemini/config/mcp_config.json: unexpected end of JSON input
  why: Client configuration could not be read safely.
  next: Review the client configuration and rerun engram doctor.

JSON summary: "status": "error", "errors": 1.

Operating System

macOS

Release Version (Report Context)

3.4.0

Agent / Client

Other

📋 Relevant Logs
{
  "check_id": "mcp_inspection_error",
  "result": "error",
  "severity": "error",
  "reason_code": "mcp_inspection_error",
  "message": "Could not inspect generic MCP registrations: parse <tmp>/home/.gemini/config/mcp_config.json: unexpected end of JSON input",
  "why": "Client configuration could not be read safely.",
  "evidence": null,
  "safe_next_step": "Review the client configuration and rerun engram doctor.",
  "requires_confirmation": false
}
💡 Additional Context

Client: Pi (via gentle-engram). The doctor check itself is client-independent.

Current main (8589a5f) still has the same path: internal/setup/registry.go StaleMCPCommands() skips only os.IsNotExist, then calls json.Unmarshal on the file content and returns parse <path>: … for empty data, ending the loop over all adapters.

Workaround: write {"mcpServers": {}} into the empty file.

Dominant language
Go
Stars
7.1k
Forks
729
Avg merge
11h 17m
Merged PRs (30d)
334

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Gentleman-Programming/engram

All issues in Gentleman-Programming/engram

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.