claude_desktop: surface headroom MCP removal failures instead of swallowing them

The removal block's json.loads() was wrapped in a bare try/except that set
data = None on any parse error, then silently no-op'd (isinstance(data, dict)
is False) with exit 0 -- so a malformed claude_desktop_config.json meant the
headroom entry was never removed and bashio::log.warning never fired.

Drop the try/except so parse errors propagate naturally and the script exits
non-zero, matching the sibling rtk removal block's existing convention and
triggering the bashio::log.warning fallback.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MgMcG1QjsSHcDQBxgPpRUw
This commit is contained in:
Claude
2026-07-07 14:35:52 +00:00
parent a9cf84077b
commit 86395a85a0

View File

@@ -51,10 +51,7 @@ import os
from pathlib import Path
path = Path(os.environ["CLAUDE_DESKTOP_CONFIG"])
try:
data = json.loads(path.read_text())
except Exception:
data = None
data = json.loads(path.read_text())
if isinstance(data, dict):
servers = data.get("mcpServers")
if isinstance(servers, dict) and servers.pop("headroom", None) is not None: