XTLS/Xray-core · error

Config: Failed to parse Blackhole response config.

Error message

Config: Failed to parse Blackhole response config.

What it means

Raised in BlackholeConfig.Build when the inline blackhole 'response' object cannot be parsed by the config loader — the response JSON has an unknown 'type' or malformed structure. The loader error is wrapped as Base.

Solutions

  1. Use a valid response type ("none" or "http") in the blackhole response settings
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at infra/conf/blackhole.go:33 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/5518c45191db3667. Report an issue: GitHub.

Appendix: source

Thrown at infra/conf/blackhole.go:33

	return new(blackhole.NoneResponse), nil
}

type HTTPResponse struct{}

func (*HTTPResponse) Build() (proto.Message, error) {
	return new(blackhole.HTTPResponse), nil
}

type BlackholeConfig struct {
	Response json.RawMessage `json:"response"`
}

func (v *BlackholeConfig) Build() (proto.Message, error) {
	config := new(blackhole.Config)
	if v.Response != nil {
		response, _, err := configLoader.Load(v.Response)
		if err != nil {
			return nil, errors.New("Config: Failed to parse Blackhole response config.").Base(err)
		}
		responseSettings, err := response.(Buildable).Build()
		if err != nil {
			return nil, err
		}
		config.Response = serial.ToTypedMessage(responseSettings)
	}

	return config, nil
}

var configLoader = NewJSONConfigLoader(
	ConfigCreatorCache{
		"none": func() interface{} { return new(NoneResponse) },
		"http": func() interface{} { return new(HTTPResponse) },
	},
	"type",
	"",

View on GitHub (pinned to 7d214f8b09)