XTLS/Xray-core · error

failed to read config:

Error message

failed to read config: 

What it means

Error "failed to read config: " thrown in XTLS/Xray-core.

Source

Thrown at infra/conf/serial/builder.go:42

func MergeConfigFromFiles(files []*core.ConfigSource) (string, error) {
	c, err := mergeConfigs(files)
	if err != nil {
		return "", err
	}

	if j, ok := creflect.MarshalToJson(c, true); ok {
		return j, nil
	}
	return "", errors.New("marshal to json failed.").AtError()
}

func mergeConfigs(files []*core.ConfigSource) (*conf.Config, error) {
	cf := &conf.Config{}
	for i, file := range files {
		errors.LogInfo(context.Background(), "Reading config: ", file)
		r, err := confloader.LoadConfig(file.Name)
		if err != nil {
			return nil, errors.New("failed to read config: ", file).Base(err)
		}
		decoder := ReaderDecoderByFormat[file.Format]
		if file.Format == "json" && UseStrictJSON {
			decoder = DecodeJSONConfigStrict
		}
		c, err := decoder(r)
		if err != nil {
			return nil, errors.New("failed to decode config: ", file).Base(err)
		}
		if i == 0 {
			*cf = *c
			continue
		}
		cf.Override(c, file.Name)
	}
	return cf, nil
}

View on GitHub (pinned to 7d214f8b09)

When it happens

Trigger: Thrown at infra/conf/serial/builder.go:42 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/54f06819e55a84e1. Report an issue: GitHub.