XTLS/Xray-core · error
Failed to get format of
Error message
Failed to get format of
What it means
Raised in LoadConfig when format detection is 'auto' but GetFormat cannot determine the format of an input file (unrecognized extension and not stdin). The file's extension/content is at fault. Logged at Warning.
Solutions
- Use a recognized extension (.json/.toml/.yaml/.pb) or pass -format explicitly
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at core/config.go:128 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15).
Data as JSON: /api/errors/5dff6fdfb104389f.
Report an issue: GitHub.
Appendix: source
Thrown at core/config.go:128
switch v := input.(type) {
case cmdarg.Arg:
files := make([]*ConfigSource, len(v))
hasProtobuf := false
for i, file := range v {
var f string
if formatName == "auto" {
if file != "stdin:" {
f = GetFormat(file)
} else {
f = "json"
}
} else {
f = formatName
}
if f == "" {
return nil, errors.New("Failed to get format of ", file).AtWarning()
}
if f == "protobuf" {
hasProtobuf = true
}
files[i] = &ConfigSource{
Name: file,
Format: f,
}
}
// only one protobuf config file is allowed
if hasProtobuf {
if len(v) == 1 {
return configLoaderByName["protobuf"].Loader(v)
} else {
return nil, errors.New("Only one protobuf config file is allowed").AtWarning()
}View on GitHub (pinned to 7d214f8b09)