flipped-aurora/gin-vue-admin · error
GVA_MCP_BIN 指向的文件不存在: %s
Error message
GVA_MCP_BIN 指向的文件不存在: %s
What it means
resolveManagedStartCommand validates the GVA_MCP_BIN environment variable and fails fast when it points to a path that does not exist on disk. This is a configuration error: the user explicitly told the manager which binary to run, but the path is wrong.
Source
Thrown at server/mcp/standalone_manager.go:306
}
}
}
}
func resolveManagedStartCommand() (string, []string, string, string, error) {
serverRoot := resolveMCPServerRoot()
if serverRoot == "" {
return "", nil, "", "", errors.New("未找到 server 根目录,无法启动 MCP 独立服务")
}
configPath, err := resolveMCPConfigPath(serverRoot)
if err != nil {
return "", nil, "", "", err
}
if explicit := strings.TrimSpace(os.Getenv("GVA_MCP_BIN")); explicit != "" {
if !fileExists(explicit) {
return "", nil, "", "", fmt.Errorf("GVA_MCP_BIN 指向的文件不存在: %s", explicit)
}
return explicit, []string{"-config", configPath}, filepath.Dir(explicit), configPath, nil
}
binaryPath, err := ensureManagedBinary(serverRoot)
if err != nil {
return "", nil, "", "", err
}
return binaryPath, []string{"-config", configPath}, serverRoot, configPath, nil
}
func ensureManagedBinary(serverRoot string) (string, error) {
runtimeDir, err := ensureMCPRuntimeDir()
if err != nil {
return "", err
}
View on GitHub (pinned to 3136500ef3)
Solutions
- Set GVA_MCP_BIN to a verified absolute path of the compiled binary: ls -la "$GVA_MCP_BIN" to confirm.
- Unset GVA_MCP_BIN so the manager falls back to ensureManagedBinary, which locates/builds ./cmd/mcp automatically.
- If using ~ in the path, expand it ($HOME or an absolute path) — Go does not expand tilde in env vars.
- Rebuild and reinstall the binary at the expected path for the current platform.
Example fix
// before export GVA_MCP_BIN="~/bin/gva-mcp" # tilde not expanded; file may not exist // after export GVA_MCP_BIN="$HOME/bin/gva-mcp" # absolute path ls -la "$GVA_MCP_BIN" || go build -o "$HOME/bin/gva-mcp" ./cmd/mcp
Defensive patterns
Strategy: validation
Validate before calling
bin := os.Getenv("GVA_MCP_BIN")
if bin != "" {
if _, err := os.Stat(bin); err != nil {
return fmt.Errorf("GVA_MCP_BIN points to missing file: %s", bin)
}
} Try / catch
status, err := StartManagedStandalone(ctx)
if err != nil && strings.Contains(err.Error(), "GVA_MCP_BIN") {
os.Unsetenv("GVA_MCP_BIN") // fall back to auto-locate/auto-build
status, err = StartManagedStandalone(ctx)
} Prevention
- Use absolute paths (expand $HOME, never ~) in GVA_MCP_BIN.
- Validate the path exists (and is executable) in deployment scripts before start.
- Omit GVA_MCP_BIN entirely when you want auto-locate/auto-build behavior.
- Re-verify the env var after CI artifacts are renamed or moved.
When it happens
Trigger: GVA_MCP_BIN is set (non-empty after TrimSpace) and fileExists(explicit) returns false: typo in path, file deleted after a clean, relative path evaluated from an unexpected working directory, binary rebuilt under a different name.
Common situations: CI/CD moved or renamed the artifact; developer pointed GVA_MCP_BIN at a source file instead of a compiled binary; path uses ~ which is not shell-expanded for os.Getenv; container image changed.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- 未找到 server 根目录,无法启动 MCP 独立服务
- 未找到 MCP 配置文件,请确认 cmd/mcp/config.yaml 或 server/config.yaml 存在
- 未找到 MCP 独立配置文件,请在当前目录、cmd/mcp 目录或通过 -config / GVA_MCP_CONFIG
- 未能自动识别项目根目录,请在 MCP 配置中设置 autocode.root
- go.mod 中未找到 module 定义
AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31).
Data as JSON: /api/errors/856f23e2683dd398.
Report an issue: GitHub.