XTLS/Xray-core · error
invalid geodata asset file:
Error message
invalid geodata asset file:
What it means
Thrown by GeodataAssetConfig.Build when filesystem.StatAsset fails for the asset's file field, meaning the asset filename cannot be stat'ed in the asset location (typically the Xray resource directory). Every asset entry pairs a download URL with the local file name it maps to; the file must resolve in the asset filesystem. The underlying stat error is chained as the base cause.
Source
Thrown at infra/conf/geodata.go:23
"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")
}
return nil
}
View on GitHub (pinned to 7d214f8b09)
Solutions
- Set file to a plain asset filename like "geosite.dat" or "geoip.dat" matching what the URL downloads
- Verify XRAY_LOCATION_ASSET (default: the executable's directory or a system location) exists and is readable
- Do not use directory paths or empty strings for file
Example fix
// before
{ "url": "https://example/geosite.dat", "file": "/etc/xray/geosite.dat" }
// after
{ "url": "https://example/geosite.dat", "file": "geosite.dat" } Defensive patterns
Strategy: validation
Validate before calling
// Check the asset file name is a bare, non-empty filename
if asset.File == "" || strings.ContainsAny(asset.File, "/\\") {
return fmt.Errorf("asset file must be a non-empty bare filename")
} Prevention
- Use bare filenames like geosite.dat, never absolute paths
- Ensure XRAY_LOCATION_ASSET points to an existing readable directory before startup
When it happens
Trigger: Setting geodata.assets[].file to an empty string, a path with invalid characters, a subdirectory that does not exist in the asset dir, or a name that the platform-specific asset loader cannot resolve.
Common situations: Omitting the file field (defaults to empty string, which fails stat); using a full filesystem path instead of a bare asset name; name mismatch between the file field and the geosite/geoip filename expected later; missing XRAY_LOCATION_ASSET directory.
Related errors
- invalid geodata asset url:
- 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/a30da83770464dca.
Report an issue: GitHub.