{"record":{"id":"1e93d60d54b228db","repo":"flipped-aurora/gin-vue-admin","slug":"mcp-s-1e93d6","errorCode":null,"errorMessage":"等待 MCP 独立服务启动超时，请查看日志: %s","messagePattern":"等待 MCP 独立服务启动超时，请查看日志: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/mcp/standalone_manager.go","lineNumber":280,"sourceCode":"\tif resp.StatusCode >= http.StatusOK && resp.StatusCode < http.StatusMultipleChoices {\n\t\treturn true, nil\n\t}\n\n\treturn false, fmt.Errorf(\"MCP 健康检查失败: %s\", resp.Status)\n}\n\nfunc waitForManagedProcess(ctx context.Context, meta *managedProcessMeta) (ManagedStandaloneStatus, error) {\n\tdeadline := time.NewTimer(mcpStartWaitTimeout)\n\tticker := time.NewTicker(300 * time.Millisecond)\n\tdefer deadline.Stop()\n\tdefer ticker.Stop()\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn GetManagedStandaloneStatus(context.Background()), ctx.Err()\n\t\tcase <-deadline.C:\n\t\t\treturn GetManagedStandaloneStatus(context.Background()), fmt.Errorf(\"等待 MCP 独立服务启动超时，请查看日志: %s\", meta.LogPath)\n\t\tcase <-ticker.C:\n\t\t\tcurrent := GetManagedStandaloneStatus(context.Background())\n\t\t\tif current.Reachable {\n\t\t\t\treturn current, nil\n\t\t\t}\n\t\t\tif meta.PID > 0 && !processExists(meta.PID) {\n\t\t\t\treturn current, fmt.Errorf(\"MCP 独立进程已退出，请查看日志: %s\", meta.LogPath)\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc resolveManagedStartCommand() (string, []string, string, string, error) {\n\tserverRoot := resolveMCPServerRoot()\n\tif serverRoot == \"\" {\n\t\treturn \"\", nil, \"\", \"\", errors.New(\"未找到 server 根目录，无法启动 MCP 独立服务\")\n\t}\n","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/flipped-aurora/gin-vue-admin/blob/3136500ef380842b0eb6c4daa87c3f8a47fcf9e0/server/mcp/standalone_manager.go#L262-L298","documentation":"waitForManagedProcess gives up when the start deadline (mcpStartWaitTimeout) expires without the standalone MCP process ever becoming reachable via health checks. The error includes the log file path so developers can diagnose why startup never completed.","triggerScenarios":"StartManagedStandalone spawns the process, cmd.Start succeeds, but repeated GetManagedStandaloneStatus polls never report Reachable before the deadline: config errors, port binding failure, DB connect failure, or extremely slow startup (slow disk, cold build).","commonSituations":"Wrong GVA_MCP_CONFIG (bad port, occupied port, unreachable DB/Redis); binary panics on boot but slowly; firewall silently drops health probes; system under heavy load making startup exceed the timeout.","solutions":["Open meta.LogPath referenced in the message — startup errors (port in use, bad config, panic) are written there.","Verify the config at GVA_MCP_CONFIG path: port free (lsof -i :port), DB/Redis reachable.","Increase mcpStartWaitTimeout if the environment is legitimately slow to start.","Run the binary manually with the same -config flag to see the error directly."],"exampleFix":"// before\nGVA_MCP_CONFIG=/etc/gva/mcp.yaml ./server-mcp -config /etc/gva/mcp.yaml\n// after: verify config and port first\nGVA_MCP_CONFIG=/etc/gva/mcp.yaml ./server-mcp -config /etc/gva/mcp.yaml\n# then: ss -ltnp | grep <configured-port>  (is it bound? is it the right port?)","handlingStrategy":"fallback","validationCode":"// validate config before attempting a managed start\ncfg, err := os.ReadFile(configPath)\nif err != nil { return fmt.Errorf(\"GVA_MCP_CONFIG unreadable: %w\", err) }\nif port := extractPort(cfg); !portFree(port) {\n    return fmt.Errorf(\"port %d already in use\", port)\n}","typeGuard":null,"tryCatchPattern":"status, err := StartManagedStandalone(ctx)\nif err != nil && strings.Contains(err.Error(), \"超时\") {\n    // fallback: read the log file cited in the error and surface it\n    if logs, lerr := os.ReadFile(meta.LogPath); lerr == nil {\n        log.Printf(\"mcp start timed out; log tail: %s\", tail(logs, 50))\n    }\n    return err\n}","preventionTips":["Always check the log file path from the error before retrying blindly.","Pre-check that the configured port is free.","Keep mcpStartWaitTimeout generous for slow/cold environments.","Validate GVA_MCP_CONFIG schema at boot (DB/Redis addresses reachable)."],"tags":["timeout","mcp","process-startup","health-check"],"backgroundTag":"startup-timeout","analyzedSha":"3136500ef380842b0eb6c4daa87c3f8a47fcf9e0","analyzedAt":"2026-08-31T13:50:02.721Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}