XTLS/Xray-core · error

failed to parse json config

Error message

failed to parse json config

What it means

Error "failed to parse json config" thrown in XTLS/Xray-core.

Source

Thrown at infra/conf/serial/loader.go:100

	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
}

// DecodeTOMLConfig reads from reader and decode the config into *conf.Config
// using github.com/pelletier/go-toml and map to convert toml to json.
func DecodeTOMLConfig(reader io.Reader) (*conf.Config, error) {
	tomlFile, err := io.ReadAll(reader)
	if err != nil {
		return nil, errors.New("failed to read config file").Base(err)
	}

	configMap := make(map[string]interface{})
	if err := toml.Unmarshal(tomlFile, &configMap); err != nil {
		return nil, errors.New("failed to convert toml to map").Base(err)
	}

View on GitHub (pinned to 7d214f8b09)

When it happens

Trigger: Thrown at infra/conf/serial/loader.go:100 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15). Data as JSON: /api/errors/5ced56d3ef4cd980. Report an issue: GitHub.