{"record":{"id":"5d7ff1e07893f581","repo":"fatedier/frp","slug":"virtual-net-is-not-supported-on-this-platform-s","errorCode":null,"errorMessage":"virtual net is not supported on this platform (%s/%s)","messagePattern":"virtual net is not supported on this platform \\((.+?)/(.+?)\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/vnet/tun_unsupported.go","lineNumber":28,"sourceCode":"// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n//go:build !darwin && !linux\n\npackage vnet\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"runtime\"\n\n\t\"golang.zx2c4.com/wireguard/tun\"\n)\n\nfunc openTun(_ context.Context, _ string) (tun.Device, error) {\n\treturn nil, fmt.Errorf(\"virtual net is not supported on this platform (%s/%s)\", runtime.GOOS, runtime.GOARCH)\n}\n","sourceCodeStart":10,"sourceCodeEnd":30,"githubUrl":"https://github.com/fatedier/frp/blob/6c8a8d0a97d03b44e9528d30b30c70cb9d61b405/pkg/vnet/tun_unsupported.go#L10-L30","documentation":"Build-tag stub returned by openTun on platforms where frp's vnet has no TUN implementation (tun_unsupported.go compiles everywhere except supported platforms like linux). If vnet is enabled on such a platform, TUN device creation immediately fails with this message naming GOOS/GOARCH. It is a hard capability gap, not a runtime fault.","triggerScenarios":"Setting vnet.enabled = true in frpc.toml (or a config loading vnet) on Windows, macOS, FreeBSD, or any non-supported GOOS/GOARCH, then starting frpc — openTun hits the stub and returns this error during vnet controller setup.","commonSituations":"Developing on a Mac/Windows workstation with a config borrowed from a Linux server; running frpc in a container built on an unusual base image; CI tests enabling vnet on non-Linux runners.","solutions":["Disable vnet on that platform: set vnet.enabled = false (or remove the [vnet] section) in frpc.toml","Run the vnet-enabled frpc on Linux, where the TUN implementation exists","If cross-platform vnet is required, track upstream frp for platform support rather than patching the stub","Guard configs per-OS: keep separate config files for local dev and the Linux deployment"],"exampleFix":"# before (frpc.toml on macOS/Windows)\n[vnet]\nenabled = true\n\n# after (local dev on unsupported OS)\n[vnet]\nenabled = false","handlingStrategy":"validation","validationCode":"// gate vnet on platform support before starting frpc\nif runtime.GOOS != \"linux\" {\n    cfg.Vnet.Enabled = false\n}","typeGuard":"func vnetSupported() bool { return runtime.GOOS == \"linux\" }","tryCatchPattern":null,"preventionTips":["Keep separate configs per environment; leave vnet enabled only in the Linux deployment","Document that vnet is Linux-only in the service README","Fail fast at config-load time on unsupported platforms with a clear message"],"tags":["vnet","platform","tun","config"],"backgroundTag":null,"analyzedSha":"6c8a8d0a97d03b44e9528d30b30c70cb9d61b405","analyzedAt":"2026-08-15T06:53:27.215Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}