{"record":{"id":"856f23e2683dd398","repo":"flipped-aurora/gin-vue-admin","slug":"gva-mcp-bin-s","errorCode":null,"errorMessage":"GVA_MCP_BIN 指向的文件不存在: %s","messagePattern":"GVA_MCP_BIN 指向的文件不存在: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/mcp/standalone_manager.go","lineNumber":306,"sourceCode":"\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\n\tconfigPath, err := resolveMCPConfigPath(serverRoot)\n\tif err != nil {\n\t\treturn \"\", nil, \"\", \"\", err\n\t}\n\n\tif explicit := strings.TrimSpace(os.Getenv(\"GVA_MCP_BIN\")); explicit != \"\" {\n\t\tif !fileExists(explicit) {\n\t\t\treturn \"\", nil, \"\", \"\", fmt.Errorf(\"GVA_MCP_BIN 指向的文件不存在: %s\", explicit)\n\t\t}\n\t\treturn explicit, []string{\"-config\", configPath}, filepath.Dir(explicit), configPath, nil\n\t}\n\n\tbinaryPath, err := ensureManagedBinary(serverRoot)\n\tif err != nil {\n\t\treturn \"\", nil, \"\", \"\", err\n\t}\n\n\treturn binaryPath, []string{\"-config\", configPath}, serverRoot, configPath, nil\n}\n\nfunc ensureManagedBinary(serverRoot string) (string, error) {\n\truntimeDir, err := ensureMCPRuntimeDir()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/flipped-aurora/gin-vue-admin/blob/3136500ef380842b0eb6c4daa87c3f8a47fcf9e0/server/mcp/standalone_manager.go#L288-L324","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nexport GVA_MCP_BIN=\"~/bin/gva-mcp\"          # tilde not expanded; file may not exist\n// after\nexport GVA_MCP_BIN=\"$HOME/bin/gva-mcp\"      # absolute path\nls -la \"$GVA_MCP_BIN\" || go build -o \"$HOME/bin/gva-mcp\" ./cmd/mcp","handlingStrategy":"validation","validationCode":"bin := os.Getenv(\"GVA_MCP_BIN\")\nif bin != \"\" {\n    if _, err := os.Stat(bin); err != nil {\n        return fmt.Errorf(\"GVA_MCP_BIN points to missing file: %s\", bin)\n    }\n}","typeGuard":null,"tryCatchPattern":"status, err := StartManagedStandalone(ctx)\nif err != nil && strings.Contains(err.Error(), \"GVA_MCP_BIN\") {\n    os.Unsetenv(\"GVA_MCP_BIN\") // fall back to auto-locate/auto-build\n    status, err = StartManagedStandalone(ctx)\n}","preventionTips":["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."],"tags":["configuration","env-var","mcp","missing-file"],"backgroundTag":"missing-env-var","analyzedSha":"3136500ef380842b0eb6c4daa87c3f8a47fcf9e0","analyzedAt":"2026-08-31T13:50:02.721Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}