XTLS/Xray-core · error
invalid id + id
Error message
invalid id + id
What it means
Thrown by Realm.Build() when the path component of the Realm URL, after trimming the leading '/' and percent-decoding, is empty. The path carries the Realm session ID; 'realm://token@host' with no trailing path fails here. It is checked after token extraction.
Source
Thrown at infra/conf/transport_finalmask.go:869
if scheme == "http" {
port = "80"
}
}
token, err = url.PathUnescape(u.User.String())
if err != nil {
return nil, err
}
if token == "" {
return nil, errors.New("invalid token", token)
}
id, err = url.PathUnescape(strings.TrimPrefix(u.EscapedPath(), "/"))
if err != nil {
return nil, err
}
if id == "" {
return nil, errors.New("invalid id", id)
}
if len(c.StunServers) == 0 {
return nil, errors.New("empty stunServers")
}
for _, s := range c.StunServers {
_, _, err = net.SplitHostPort(s)
if err != nil {
return nil, err
}
}
stunServers = c.StunServers
if c.TlsConfig != nil {
tc, err := c.TlsConfig.Build()
if err != nil {View on GitHub (pinned to 7d214f8b09)
Solutions
- Append the session ID as the URL path: 'realm://token@host:port/<id>'.
- Ensure the path is not just '/'.
- Percent-encode the ID if it contains reserved characters so decoding round-trips.
Example fix
// before "url": "realm://mytoken@signal.example.com:8443" // after "url": "realm://mytoken@signal.example.com:8443/session-42"
Defensive patterns
Strategy: validation
Validate before calling
u, _ := url.Parse(raw)
if strings.TrimPrefix(u.EscapedPath(), "/") == "" {
return fmt.Errorf("realm url is missing the session id path")
} Prevention
- Always terminate Realm URLs with the session id segment.
- Do not strip trailing path components when shortening URLs.
- Percent-encode ids so unescaping cannot yield an empty string.
When it happens
Trigger: A URL like 'realm://token@host:8443' or 'realm://token@host:8443/' (root-only path) triggers this. The decoded path must be at least one non-empty segment.
Common situations: Omitting the ID path when shortening URLs; trimming what looked like a redundant trailing segment; misreading docs where the final path element is the session ID.
Related errors
- invalid scheme + u.Scheme
- invalid host + host
- invalid token + token
- bridge tag is empty
- bridge domain is empty
AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15).
Data as JSON: /api/errors/41ccbfd4cfa28731.
Report an issue: GitHub.