XTLS/Xray-core · error
empty tag name!
Error message
empty tag name!
What it means
RemoveRule treats an empty tag as a programming error: the removal loop only runs when tag != ", so an empty string can never match anything and is rejected rather than silently succeeding. Tags are the sole selector for rule removal.
Source
Thrown at app/router/router.go:228
// RemoveRule implements routing.Router.
func (r *Router) RemoveRule(tag string) error {
r.mu.Lock()
defer r.mu.Unlock()
newRules := []*Rule{}
if tag != "" {
for _, rule := range r.rules {
if rule.RuleTag != tag {
newRules = append(newRules, rule)
} else if rule.Webhook != nil {
rule.Webhook.Close()
}
}
r.rules = newRules
return nil
}
return errors.New("empty tag name!")
}
// ListRule implements routing.Router
func (r *Router) ListRule() []routing.Route {
r.mu.Lock()
defer r.mu.Unlock()
ruleList := make([]routing.Route, 0)
for _, rule := range r.rules {
ruleList = append(ruleList, &Route{
outboundTag: rule.Tag,
ruleTag: rule.RuleTag,
})
}
return ruleList
}
func (r *Router) pickRouteInternal(ctx routing.Context) (*Rule, routing.Context, error) {
// SkipDNSResolve is set from DNS module.View on GitHub (pinned to 7d214f8b09)
Solutions
- Supply the exact ruleTag of an existing rule (obtainable from ListRule)
- Guard client-side against empty tags before calling RemoveRule
- Ensure rules you intend to manage dynamically are configured with ruleTag set
Example fix
// before
r.RemoveRule(rule.GetRuleTag()) // rule had no ruleTag -> ""
// after
// configure rules with explicit ruleTag, then:
r.RemoveRule("my-rule-tag") Defensive patterns
Strategy: validation
Validate before calling
if strings.TrimSpace(tag) == "" {
return fmt.Errorf("ruleTag required for removal")
} Prevention
- Require ruleTag on every dynamically-managed rule at creation time
- Populate removal UIs from ListRule output so tags are never hand-typed empty
- Client-side guard empty selections before the RPC
When it happens
Trigger: Calling RemoveRule with an empty/zero-value string; protobuf field ruleTag left unset by client code.
Common situations: Clients reading ruleTag from a struct where the field was never populated; UI panels sending empty selections; default-initialized requests.
Related errors
- failed to parse user
- unable to select outbounds
- unsupported GetPrincipleTarget
- cannot find tag
- unsupported router implementation
AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15).
Data as JSON: /api/errors/dc7e60973cf60634.
Report an issue: GitHub.