flipped-aurora/gin-vue-admin · critical
panic(err) — standalone MCP config load failed
Error message
panic(err) — standalone MCP config load failed
What it means
The standalone MCP server binary panics at startup when loadStandaloneConfig cannot load or parse the MCP configuration (missing config file, invalid YAML, or missing required fields). panic(err) is used deliberately so the process aborts loudly instead of running with a bad config.
Source
Thrown at server/cmd/mcp/main.go:15
package main
import (
"fmt"
"github.com/flipped-aurora/gin-vue-admin/server/global"
mcpTool "github.com/flipped-aurora/gin-vue-admin/server/mcp"
"github.com/flipped-aurora/gin-vue-admin/server/utils/logger"
_ "go.uber.org/automaxprocs"
)
func main() {
configPath, err := loadStandaloneConfig()
if err != nil {
panic(err)
}
if err := initializeStandaloneLogger(); err != nil {
panic(err)
}
addr := fmt.Sprintf(":%d", global.GVA_CONFIG.MCP.Addr)
server := mcpTool.NewStreamableHTTPServer()
logger.Bg().Mod("cli").
Field("config", configPath).
Field("addr", addr).
Field("path", global.GVA_CONFIG.MCP.Path).
Field("upstream", global.GVA_CONFIG.MCP.UpstreamBaseURL).
Info("mcp独立服务启动")
if err := server.Start(addr); err != nil {
logger.Bg().Mod("cli").Err(err).Error("mcp独立服务启动失败")View on GitHub (pinned to 3136500ef3)
Solutions
- Confirm the config file exists at the path loadStandaloneConfig resolves (check working directory and any -c/env path)
- Validate the YAML syntax (yamllint) and required MCP fields (addr, path, upstream)
- Run the binary from the project root or pass an explicit absolute config path
- Compare against the repo's example config for missing keys
Example fix
// before ./mcp-server # run from / with no config // after cd /opt/gva && ./mcp-server --config /opt/gva/config.yaml
Defensive patterns
Strategy: validation
Validate before calling
if _, err := os.Stat(configPath); err != nil { log.Fatalf("MCP config not found at %s: %v", configPath, err) } Try / catch
// in a wrapper
func run() (err error) { defer func() { if r := recover(); r != nil { err = fmt.Errorf("mcp startup panic: %v", r) } }(); /* start server */; return nil } Prevention
- Ship an example config and validate it in CI (yamllint + field checks)
- Use an absolute config path or resolve relative to the executable
- Document required working directory for the mcp binary
- Fail fast in a wrapper script that checks the config exists before exec
When it happens
Trigger: Running `go run ./cmd/mcp` or the built mcp binary with a missing/misplaced config file, wrong config path flag/env, or a config that fails validation inside loadStandaloneConfig.
Common situations: Deploying the mcp binary without copying the config; running from a different working directory than expected; YAML syntax error after hand-editing; renaming config keys after an upgrade.
Related errors
- 未找到 MCP 独立配置文件,请在当前目录、cmd/mcp 目录或通过 -config / GVA_MCP_CONFIG
- 未能自动识别项目根目录,请在 MCP 配置中设置 autocode.root
- fatal error config file: %w
- fatal error unmarshal config: %w
- panic(err) — standalone MCP logger init failed
AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31).
Data as JSON: /api/errors/470e53ff90c02dd6.
Report an issue: GitHub.