XTLS/Xray-core · error
invalid geodata asset url:
Error message
invalid geodata asset url:
What it means
Thrown by GeodataAssetConfig.Build when the asset's url field fails validateHTTPS, i.e. it cannot be parsed as a request URI or its scheme is not https / host is empty. Geodata assets are downloaded over HTTPS only, so any malformed or non-HTTPS URL is rejected before the asset table is built. The underlying parse/scheme error is attached as the base cause.
Source
Thrown at infra/conf/geodata.go:20
import (
"net/url"
"github.com/robfig/cron/v3"
"github.com/xtls/xray-core/app/geodata"
"github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/common/platform/filesystem"
"google.golang.org/protobuf/proto"
)
type GeodataAssetConfig struct {
URL string `json:"url"`
File string `json:"file"`
}
func (c *GeodataAssetConfig) Build() (*geodata.Asset, error) {
if err := validateHTTPS(c.URL); err != nil {
return nil, errors.New("invalid geodata asset url: ", c.URL).Base(err)
}
if _, err := filesystem.StatAsset(c.File); err != nil {
return nil, errors.New("invalid geodata asset file: ", c.File).Base(err)
}
return &geodata.Asset{
Url: c.URL,
File: c.File,
}, nil
}
func validateHTTPS(s string) error {
u, err := url.ParseRequestURI(s)
if err != nil {
return err
}
if u.Scheme != "https" || u.Host == "" {
return errors.New("scheme must be https")
}View on GitHub (pinned to 7d214f8b09)
Solutions
- Use a URL starting with https:// and including a host, e.g. https://example.com/dat/geosite.dat
- If the mirror only supports http, host the file locally and reference it via the file field with an https-capable mirror, or set up an https endpoint
- Check for typos, stray whitespace, or missing scheme in the url string
Example fix
// before
{ "url": "http://mirror.example/geosite.dat", "file": "geosite.dat" }
// after
{ "url": "https://mirror.example/geosite.dat", "file": "geosite.dat" } Defensive patterns
Strategy: validation
Validate before calling
// Validate geodata asset URL before building config
u, err := url.ParseRequestURI(asset.URL)
if err != nil || u.Scheme != "https" || u.Host == "" {
return fmt.Errorf("asset url %q must be a valid https URL", asset.URL)
} Prevention
- Normalize all geodata mirror URLs to https:// at config generation time
- Test mirrors with curl -I https://... before committing them to configs
When it happens
Trigger: Configuring geodata.assets[].url as an http:// URL, an ftp:// URL, a scheme-less host like 'geosite.example.com', or a string that fails url.ParseRequestURI. Error 285 ('scheme must be https') is the sibling produced when parsing succeeds but the scheme check fails.
Common situations: Pointing at a mirror that only serves plain http; forgetting the https:// scheme; using a GitHub raw URL with a typo; copying an asset URL from older configs that predate the HTTPS enforcement.
Related errors
- invalid geodata asset file:
- invalid geodata cron
- bridge tag is empty
- bridge domain is empty
- portal tag is empty
AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15).
Data as JSON: /api/errors/ae998d279166de0c.
Report an issue: GitHub.