Skip to content

fix(config): show precise malformed config diagnostics#2415

Open
afjcjsbx wants to merge 4 commits intosipeed:mainfrom
afjcjsbx:feat/config-error-diagnostics
Open

fix(config): show precise malformed config diagnostics#2415
afjcjsbx wants to merge 4 commits intosipeed:mainfrom
afjcjsbx:feat/config-error-diagnostics

Conversation

@afjcjsbx
Copy link
Copy Markdown
Collaborator

@afjcjsbx afjcjsbx commented Apr 7, 2026

📝 Description

This PR improves malformed configuration diagnostics during startup and config loading.

It adds richer JSON parsing errors for config.json, including:

  • exact line and column information for syntax/type errors
  • a short source preview with a caret pointing to the failing position
  • exact JSON paths for unknown fields (for example tools.weeb)
  • clearer logging when legacy/current config loading fails
  • security config parse errors that include the offending file path

It also updates gateway startup error reporting to surface a concise config error summary.

🗣️ Type of Change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 📖 Documentation update
  • ⚡ Code refactoring (no functional changes, no api changes)

🤖 AI Code Generation

  • 🤖 Fully AI-generated (100% AI, 0% Human)
  • 🛠️ Mostly AI-generated (AI draft, Human verified/modified)
  • 👨‍💻 Mostly Human-written (Human lead, AI assisted or none)

🔗 Related Issue

N/A

📚 Technical Context (Skip for Docs)

  • Reference URL: N/A
  • Reasoning: Startup failures caused by malformed config files were difficult to debug because errors did not clearly identify where the problem was. This change makes config parsing failures actionable by showing the exact location and context of the invalid input.

🧪 Test Environment

  • Hardware: Apple Silicon Mac
  • OS: macOS (darwin arm64)
  • Model/Provider: N/A (config parsing / startup diagnostics)
  • Channels: Telegram

📸 Evidence (Optional)

Click to view Logs/Screenshots

Example malformed config output:

config.json syntax error at line 401, column 33: invalid character ','
   401 |       "exec_timeout_minutes": 5,,
                                     ^

☑️ Checklist

  • My code/docs follow the style of this project.
  • I have performed a self-review of my own changes.
  • I have updated the documentation accordingly.

@sipeed-bot sipeed-bot bot added type: bug Something isn't working domain: config labels Apr 7, 2026
@afjcjsbx afjcjsbx requested a review from yinwm April 7, 2026 20:47
# Conflicts:
#	pkg/gateway/gateway.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: config type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant