XTLS/Xray-core · error

Only one protobuf config file is allowed

Error message

Only one protobuf config file is allowed

What it means

LoadConfig detected more than one config file while at least one of them is protobuf-format; protobuf configs cannot be merged, so the loader refuses to combine them with other files and demands a single protobuf file.

Solutions

  1. Supply only one .pb config, or convert others to JSON and merge
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at core/config.go:145 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/ec1fad5068eb5be3. Report an issue: GitHub.

Appendix: source

Thrown at core/config.go:145

			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()
			}
		}

		// to avoid import cycle
		return ConfigBuilderForFiles(files)
	case io.Reader:
		if f, found := configLoaderByName[formatName]; found {
			return f.Loader(v)
		} else {
			return nil, errors.New("Unable to load config in", formatName).AtWarning()
		}
	}

	return nil, errors.New("Unable to load config").AtWarning()
}

func loadProtobufConfig(data []byte) (*Config, error) {
	config := new(Config)

View on GitHub (pinned to 7d214f8b09)