{"record":{"id":"9e5c7b0921ee1b61","repo":"XTLS/Xray-core","slug":"process-lookup-is-not-supported-on-this-platform-9e5c7b","errorCode":null,"errorMessage":"process lookup is not supported on this platform","messagePattern":"process lookup is not supported on this platform","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"common/net/find_process_others.go","lineNumber":10,"sourceCode":"//go:build !windows && !linux && !android && !darwin\n\npackage net\n\nimport (\n\t\"github.com/xtls/xray-core/common/errors\"\n)\n\nfunc FindProcess(network, srcIP string, srcPort uint16, destIP string, destPort uint16) (int, string, string, error) {\n\treturn 0, \"\", \"\", errors.New(\"process lookup is not supported on this platform\")\n}\n","sourceCodeStart":1,"sourceCodeEnd":12,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/common/net/find_process_others.go#L1-L12","documentation":"FindProcess has no implementation for this platform (build tag: not windows/linux/android/darwin — e.g. FreeBSD, OpenBSD, Solaris, plan9) and the stub returns this error unconditionally. The API exists for compilation compatibility but process lookup is not implemented there.","triggerScenarios":"Compiling xray-core for any BSD, Solaris, Illumos, AIX, plan9 or js/wasm target and calling FindProcess. Every call fails identically.","commonSituations":"Porting Xray-based tooling to FreeBSD jails or OpenBSD routers; CI builds for exotic GOOS values that still execute process-routing tests.","solutions":["Exclude process-based routing rules from configs used on BSD/other platforms","Gate the call site with runtime.GOOS or build tags","Contribute a platform implementation using the OS's socket-to-process API (e.g. sysctl kvm_getfiles on FreeBSD) if you need it"],"exampleFix":"// before\npid, name, path, err := net.FindProcess(network, srcIP, srcPort, dstIP, dstPort)\nif err != nil {\n    log.Fatal(err)\n}\n\n// after\npid, name, path, err := net.FindProcess(network, srcIP, srcPort, dstIP, dstPort)\nif err != nil {\n    newError(\"process lookup unsupported here, skipping\").Base(err).WriteToLog()\n}","handlingStrategy":"validation","validationCode":"switch runtime.GOOS {\ncase \"windows\", \"linux\", \"darwin\", \"android\":\n    // supported\n    pid, name, path, err = net.FindProcess(netw, srcIP, srcPort, dstIP, dstPort)\ndefault:\n    // BSD/solaris/etc: stub always errors; skip\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Omit process-based routing rules on unsupported platforms","Check GOOS once at startup rather than handling the error per connection"],"tags":["bsd","unsupported-platform","process-lookup","build-tags"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}