XTLS/Xray-core · error
failed to parse remote JSON config
Error message
failed to parse remote JSON config
What it means
Error "failed to parse remote JSON config" thrown in XTLS/Xray-core.
Source
Thrown at infra/conf/serial/loader.go:87
return nil, errors.New("failed to read config file").Base(err)
}
return jsonConfig, nil
}
// DecodeJSONConfigStrict reads standard RFC 8259 JSON without comment-stripping.
// Used for remote sources (http/https/http+unix) where the payload is produced by
// automated systems and cannot contain JSON5/JSONC extensions. Avoids the
// byte-by-byte comment stripper and TeeReader, which are significant overhead on
// large configs.
func DecodeJSONConfigStrict(reader io.Reader) (*conf.Config, error) {
data, err := io.ReadAll(reader)
if err != nil {
return nil, errors.New("failed to read config file").Base(err)
}
jsonConfig := &conf.Config{}
if err := json.Unmarshal(data, jsonConfig); err != nil {
return nil, errors.New("failed to parse remote JSON config").Base(err)
}
return jsonConfig, nil
}
func LoadJSONConfig(reader io.Reader) (*core.Config, error) {
jsonConfig, err := DecodeJSONConfig(reader)
if err != nil {
return nil, err
}
pbConfig, err := jsonConfig.Build()
if err != nil {
return nil, errors.New("failed to parse json config").Base(err)
}
return pbConfig, nil
}
View on GitHub (pinned to 7d214f8b09)
When it happens
Trigger: Thrown at infra/conf/serial/loader.go:87 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15).
Data as JSON: /api/errors/7fded76d61e83a85.
Report an issue: GitHub.