flipped-aurora/gin-vue-admin · error

等待 MCP 独立服务启动超时,请查看日志: %s

Error message

等待 MCP 独立服务启动超时,请查看日志: %s

What it means

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.

Source

Thrown at server/mcp/standalone_manager.go:280

	if resp.StatusCode >= http.StatusOK && resp.StatusCode < http.StatusMultipleChoices {
		return true, nil
	}

	return false, fmt.Errorf("MCP 健康检查失败: %s", resp.Status)
}

func waitForManagedProcess(ctx context.Context, meta *managedProcessMeta) (ManagedStandaloneStatus, error) {
	deadline := time.NewTimer(mcpStartWaitTimeout)
	ticker := time.NewTicker(300 * time.Millisecond)
	defer deadline.Stop()
	defer ticker.Stop()

	for {
		select {
		case <-ctx.Done():
			return GetManagedStandaloneStatus(context.Background()), ctx.Err()
		case <-deadline.C:
			return GetManagedStandaloneStatus(context.Background()), fmt.Errorf("等待 MCP 独立服务启动超时,请查看日志: %s", meta.LogPath)
		case <-ticker.C:
			current := GetManagedStandaloneStatus(context.Background())
			if current.Reachable {
				return current, nil
			}
			if meta.PID > 0 && !processExists(meta.PID) {
				return current, fmt.Errorf("MCP 独立进程已退出,请查看日志: %s", meta.LogPath)
			}
		}
	}
}

func resolveManagedStartCommand() (string, []string, string, string, error) {
	serverRoot := resolveMCPServerRoot()
	if serverRoot == "" {
		return "", nil, "", "", errors.New("未找到 server 根目录,无法启动 MCP 独立服务")
	}

View on GitHub (pinned to 3136500ef3)

Solutions

  1. Open meta.LogPath referenced in the message — startup errors (port in use, bad config, panic) are written there.
  2. Verify the config at GVA_MCP_CONFIG path: port free (lsof -i :port), DB/Redis reachable.
  3. Increase mcpStartWaitTimeout if the environment is legitimately slow to start.
  4. Run the binary manually with the same -config flag to see the error directly.

Example fix

// before
GVA_MCP_CONFIG=/etc/gva/mcp.yaml ./server-mcp -config /etc/gva/mcp.yaml
// after: verify config and port first
GVA_MCP_CONFIG=/etc/gva/mcp.yaml ./server-mcp -config /etc/gva/mcp.yaml
# then: ss -ltnp | grep <configured-port>  (is it bound? is it the right port?)
Defensive patterns

Strategy: fallback

Validate before calling

// validate config before attempting a managed start
cfg, err := os.ReadFile(configPath)
if err != nil { return fmt.Errorf("GVA_MCP_CONFIG unreadable: %w", err) }
if port := extractPort(cfg); !portFree(port) {
    return fmt.Errorf("port %d already in use", port)
}

Try / catch

status, err := StartManagedStandalone(ctx)
if err != nil && strings.Contains(err.Error(), "超时") {
    // fallback: read the log file cited in the error and surface it
    if logs, lerr := os.ReadFile(meta.LogPath); lerr == nil {
        log.Printf("mcp start timed out; log tail: %s", tail(logs, 50))
    }
    return err
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31). Data as JSON: /api/errors/1e93d60d54b228db. Report an issue: GitHub.