bug(doctor): an empty ~/.gemini/config/mcp_config.json fails doctor with mcp_inspection_error and skips every other adapter
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
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
- Use an isolated home and data dir:
T=$(mktemp -d); mkdir -p "$T/home/.gemini/config" "$T/data" - Create one memory so the store exists:
HOME="$T/home" ENGRAM_DATA_DIR="$T/data" engram save probe "probe body" --project probe - Run
HOME="$T/home" ENGRAM_DATA_DIR="$T/data" engram doctor --json | jq -r .status→ok(file absent) - Run
: > "$T/home/.gemini/config/mcp_config.json"and repeat step 3 →error - Run
printf ' \n' > "$T/home/.gemini/config/mcp_config.json"and repeat step 3 →error - 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
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Gentleman-Programming/engram
-
status:needs-review type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Gentleman-Programming/engram#1687 ·
Maintainers usually reply within 1 day
-
priority:medium status:needs-review type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Gentleman-Programming/engram#863 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
Gentleman-Programming/engram#1900 ·
Maintainers usually reply within 1 day
-
status:needs-review type:bug
Difficulty 3/5 1-2 days Newbie friendliness 70/100
Gentleman-Programming/engram#1897 ·
Maintainers usually reply within 1 day
-
status:needs-review type:bug
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Gentleman-Programming/engram#1896 ·
Maintainers usually reply within 1 day
All issues in Gentleman-Programming/engram
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
QuantumNous/new-api#7839 ·
Maintainers usually reply within 1 day
-
bug needs-triage service/costoptimizationhub
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
hashicorp/terraform-provider-aws#50507 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
adcontextprotocol/adcp-go#567 ·
Maintainers usually reply within 1 day
-
bug raised-by:desk
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
medici-finance/assay#3097 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
supabase-community/supabase-kubernetes#275 ·
Maintainers usually reply within 1 day