XTLS/Xray-core · error

empty attr

Error message

empty attr

What it means

A geosite rule's attribute selector is malformed: the code segment ends with '@' (no attribute name after it) or contains '@@' (empty attribute between two '@'). Attributes are the '@attr' suffix on geosite codes.

Source

Thrown at common/geodata/rule_parser.go:204

		}
		domainRules = append(domainRules, &DomainRule{Value: rule})
	}

	return domainRules, nil
}

func parseGeoSiteRule(rule string) (*DomainRule_Geosite, error) {
	file, codeWithAttrs, ok := strings.Cut(rule, ":")
	if !ok {
		return nil, errors.New("syntax error")
	}

	if file == "" {
		return nil, errors.New("empty file")
	}

	if strings.HasSuffix(codeWithAttrs, "@") || strings.Contains(codeWithAttrs, "@@") {
		return nil, errors.New("empty attr")
	}
	code, attrs, _ := strings.Cut(codeWithAttrs, "@")

	if code == "" {
		return nil, errors.New("empty code")
	}
	code = strings.ToUpper(code)

	if err := checkFile(file, code); err != nil {
		return nil, err
	}

	return &DomainRule_Geosite{
		Geosite: &GeoSiteRule{
			File:  file,
			Code:  code,
			Attrs: strings.ToLower(attrs),
		},

View on GitHub (pinned to 7d214f8b09)

Solutions

  1. Either remove the '@' entirely (match whole category) or supply a valid attribute: "geosite:cn@ads".
  2. Check the dat file's attribute list (v2fly community dat exposes attrs like @ads/@cn) to confirm the attr name exists.

Example fix

// before
"domain": ["geosite:cn@"]

// after
"domain": ["geosite:cn@ads"]
Defensive patterns

Strategy: validation

Validate before calling

if strings.HasSuffix(code, "@") || strings.Contains(code, "@@") { return fmt.Errorf("%q: empty attribute", r) }

Prevention

When it happens

Trigger: Rules like "geosite:cn@" (trailing @), "geosite:cn@@ads", "ext:gs.dat:cn@".

Common situations: Intent to filter by attribute (e.g. geosite:cn@ads) but the attribute name was deleted or doubled.

Related errors


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