XTLS/Xray-core · warning

this rule has no effective fields

Error message

this rule has no effective fields

What it means

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.

Source

Thrown at app/router/config.go:118

		}
		conds.Add(cond)
		errors.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")
	}

	if len(rr.Domain) > 0 {
		cond, err := NewDomainMatcher(rr.Domain)
		if err != nil {
			return nil, err
		}
		conds.Add(cond)
	}

	if len(rr.Process) > 0 {
		conds.Add(NewProcessNameMatcher(rr.Process))
	}

	if conds.Len() == 0 {
		return nil, errors.New("this rule has no effective fields").AtWarning()
	}

	return conds, nil
}

// Build builds the balancing rule
func (br *BalancingRule) Build(ohm outbound.Manager, dispatcher routing.Dispatcher) (*Balancer, error) {
	switch strings.ToLower(br.Strategy) {
	case "leastping":
		return &Balancer{
			selectors:   br.OutboundSelector,
			strategy:    &LeastPingStrategy{},
			fallbackTag: br.FallbackTag,
			ohm:         ohm,
		}, nil
	case "roundrobin":
		return &Balancer{
			selectors:   br.OutboundSelector,

View on GitHub (pinned to 7d214f8b09)

Solutions

  1. Add at least one supported matcher field (domain, ip, port, network, source, user, process, inboundTag, protocol)
  2. Validate rule JSON keys against the current JSON schema for the running version
  3. Remove placeholder/empty rules

Example fix

// before
{ "type": "field", "domains": ["geosite:cn"], "outboundTag": "direct" } // typo 'domains'

// after
{ "type": "field", "domain": ["geosite:cn"], "outboundTag": "direct" }
Defensive patterns

Strategy: validation

Validate before calling

func hasEffectiveField(r *router.RoutingRule) bool {
    return len(r.Domain) > 0 || len(r.Ip) > 0 || len(r.Port) > 0 ||
        len(r.Network) > 0 || len(r.Source) > 0 || len(r.User) > 0 ||
        len(r.InboundTag) > 0 || len(r.Protocol) > 0 || len(r.Process) > 0 ||
        len(r.Attributes) > 0
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15). Data as JSON: /api/errors/f226ceb54019da4a. Report an issue: GitHub.