From 12310140270f9e1e7f34e293928573f4fdf72335 Mon Sep 17 00:00:00 2001 From: tomaioo Date: Wed, 6 May 2026 23:09:33 -0700 Subject: [PATCH] fix(prime-mcp-server): silent config file parsing failures The Config classes in multiple packages (prime-mcp-server, prime-evals, prime-sandboxes, prime-tunnel) silently catch JSONDecodeError and IOError when loading ~/.prime/config.json, defaulting to empty config without warning the user. This can lead to unexpected authentication failures when config files are corrupted or have permissions issues. Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com> --- packages/prime-mcp-server/src/prime_mcp/core/config.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/prime-mcp-server/src/prime_mcp/core/config.py b/packages/prime-mcp-server/src/prime_mcp/core/config.py index 51ba19181..a00c81042 100644 --- a/packages/prime-mcp-server/src/prime_mcp/core/config.py +++ b/packages/prime-mcp-server/src/prime_mcp/core/config.py @@ -1,10 +1,13 @@ """Lightweight configuration for MCP server.""" import json +import logging import os from pathlib import Path from typing import Optional +logger = logging.getLogger(__name__) + class Config: """Minimal configuration class.""" @@ -21,7 +24,12 @@ def _load_config(self) -> None: try: config_data = json.loads(self.config_file.read_text()) self.config = config_data - except (json.JSONDecodeError, IOError): + except (json.JSONDecodeError, IOError) as e: + logger.warning( + "Failed to parse config file %s: %s. Using empty config.", + self.config_file, + e, + ) self.config = {} else: self.config = {}