XTLS/Xray-core · error

failed to post-process configuration file

Error message

failed to post-process configuration file

What it means

Config.Build wraps a failure of PostProcessConfigureFile, the step that resolves multi-file/outbound-prepend confdir merging into the final config. The error indicates the merged JSON could not be post-processed (bad refs, unloadable fragments), not a parse error of the top-level file itself.

Solutions

  1. Check the wrapped error for the offending file
  2. Verify all included config files are valid JSON and tags are consistent
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

Thrown at infra/conf/xray.go:540

				}
			}
		}
		if !strings.Contains(strings.ToLower(fn), "tail") && len(outboundPrepends) > 0 {
			c.OutboundConfigs = append(outboundPrepends, c.OutboundConfigs...)
		}
	}
}

// Build implements Buildable.
func (c *Config) Build() (*core.Config, error) {
	for key, value := range c.Env {
		if err := os.Setenv(key, value); err != nil {
			return nil, errors.New("failed to apply environment configuration").Base(err)
		}
	}

	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 {

View on GitHub (pinned to 7d214f8b09)