XTLS/Xray-core · error

failed to build API configuration

Error message

failed to build API configuration

What it means

Top-level Config.Build fails building the "api" section into its app configuration; the chained error carries the API service validation failure (bad services list or tag), preventing the API app from being registered.

Solutions

  1. Fix or remove the 'api' block
  2. Check api tag/services values against supported options
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at infra/conf/xray.go:554 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/17a135874a168460. Report an issue: GitHub.

Appendix: source

Thrown at infra/conf/xray.go:554

		}
	}

	if err := PostProcessConfigureFile(c); err != nil {
		return nil, errors.New("failed to post-process configuration file").Base(err)
	}

	config := &core.Config{
		App: []*serial.TypedMessage{
			serial.ToTypedMessage(&dispatcher.Config{}),
			serial.ToTypedMessage(&proxyman.InboundConfig{}),
			serial.ToTypedMessage(&proxyman.OutboundConfig{}),
		},
	}

	if c.API != nil {
		apiConf, err := c.API.Build()
		if err != nil {
			return nil, errors.New("failed to build API configuration").Base(err)
		}
		config.App = append(config.App, serial.ToTypedMessage(apiConf))
	}
	if c.Metrics != nil {
		metricsConf, err := c.Metrics.Build()
		if err != nil {
			return nil, errors.New("failed to build metrics configuration").Base(err)
		}
		config.App = append(config.App, serial.ToTypedMessage(metricsConf))
	}
	if c.Stats != nil {
		statsConf, err := c.Stats.Build()
		if err != nil {
			return nil, errors.New("failed to build stats configuration").Base(err)
		}
		config.App = append(config.App, serial.ToTypedMessage(statsConf))
	}

View on GitHub (pinned to 7d214f8b09)