{"record":{"id":"f226ceb54019da4a","repo":"XTLS/Xray-core","slug":"this-rule-has-no-effective-fields","errorCode":null,"errorMessage":"this rule has no effective fields","messagePattern":"this rule has no effective fields","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"app/router/config.go","lineNumber":118,"sourceCode":"\t\t}\n\t\tconds.Add(cond)\n\t\terrors.LogWarning(context.Background(), \"Due to some limitations, in UDP connections, localIP is always equal to listen interface IP, so \\\"localIP\\\" rule condition does not work properly on UDP inbound connections that listen on all interfaces\")\n\t}\n\n\tif len(rr.Domain) > 0 {\n\t\tcond, err := NewDomainMatcher(rr.Domain)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tconds.Add(cond)\n\t}\n\n\tif len(rr.Process) > 0 {\n\t\tconds.Add(NewProcessNameMatcher(rr.Process))\n\t}\n\n\tif conds.Len() == 0 {\n\t\treturn nil, errors.New(\"this rule has no effective fields\").AtWarning()\n\t}\n\n\treturn conds, nil\n}\n\n// Build builds the balancing rule\nfunc (br *BalancingRule) Build(ohm outbound.Manager, dispatcher routing.Dispatcher) (*Balancer, error) {\n\tswitch strings.ToLower(br.Strategy) {\n\tcase \"leastping\":\n\t\treturn &Balancer{\n\t\t\tselectors:   br.OutboundSelector,\n\t\t\tstrategy:    &LeastPingStrategy{},\n\t\t\tfallbackTag: br.FallbackTag,\n\t\t\tohm:         ohm,\n\t\t}, nil\n\tcase \"roundrobin\":\n\t\treturn &Balancer{\n\t\t\tselectors:   br.OutboundSelector,","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/app/router/config.go#L100-L136","documentation":"Building a routing rule produced zero matchable conditions: none of the supported fields (domain, ip, port, network, source, user, process, etc.) yielded a matcher. The error is marked AtWarning, meaning the rule is ignored rather than fatally failing config load in some paths.","triggerScenarios":"A configured rule contains only unrecognized/empty fields, e.g. only attributes or a typo'd field name that deserializes to nothing the condition builder understands.","commonSituations":"Hand-edited JSON with a misspelled key (e.g. \"domains\" instead of \"domain\"); rules relying on fields only populated by higher-level tooling; empty rule objects copied from templates.","solutions":["Add at least one supported matcher field (domain, ip, port, network, source, user, process, inboundTag, protocol)","Validate rule JSON keys against the current JSON schema for the running version","Remove placeholder/empty rules"],"exampleFix":"// before\n{ \"type\": \"field\", \"domains\": [\"geosite:cn\"], \"outboundTag\": \"direct\" } // typo 'domains'\n\n// after\n{ \"type\": \"field\", \"domain\": [\"geosite:cn\"], \"outboundTag\": \"direct\" }","handlingStrategy":"validation","validationCode":"func hasEffectiveField(r *router.RoutingRule) bool {\n    return len(r.Domain) > 0 || len(r.Ip) > 0 || len(r.Port) > 0 ||\n        len(r.Network) > 0 || len(r.Source) > 0 || len(r.User) > 0 ||\n        len(r.InboundTag) > 0 || len(r.Protocol) > 0 || len(r.Process) > 0 ||\n        len(r.Attributes) > 0\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate rules against the JSON schema for the deployed version","Watch startup logs for this warning and prune offending rules","Prefer config generation tools over hand-editing rule arrays"],"tags":["routing","configuration","rule-matching"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}