caddyserver/caddy · error

invalid matcher factory, must be CELMatcherFactory or CELMat

Error message

invalid matcher factory, must be CELMatcherFactory or CELMatcherWithErrorFactory: %T

What it means

Error "invalid matcher factory, must be CELMatcherFactory or CELMatcherWithErrorFactory: %T" thrown in caddyserver/caddy.

Source

Thrown at modules/caddyhttp/celmatcher.go:548

				func(args ...ref.Val) ref.Val {
					// The request value, guaranteed to be of type celHTTPRequest
					celReq := args[0]
					// If needed this call could be changed to convert the value
					// to a *http.Request using CEL's ConvertToNative method.
					httpReq := celReq.Value().(celHTTPRequest)
					if m, ok := matcher.(RequestMatcherWithError); ok {
						match, err := m.MatchWithError(httpReq.Request)
						if err != nil {
							return types.WrapErr(err)
						}
						return types.Bool(match)
					}
					return types.Bool(matcher.Match(httpReq.Request))
				},
			), nil
		}

		return nil, fmt.Errorf("invalid matcher factory, must be CELMatcherFactory or CELMatcherWithErrorFactory: %T", fac)
	}
}

// CELMatcherRuntimeFunction creates a function binding for when the input to the matcher
// is dynamically resolved rather than a set of static constant values.
func CELMatcherRuntimeFunction(funcName string, fac any) functions.BinaryOp {
	return func(celReq, matcherData ref.Val) ref.Val {
		if factory, ok := fac.(CELMatcherWithErrorFactory); ok {
			matcher, err := factory(matcherData)
			if err != nil {
				return types.WrapErr(err)
			}
			httpReq := celReq.Value().(celHTTPRequest)
			match, err := matcher.MatchWithError(httpReq.Request)
			if err != nil {
				return types.WrapErr(err)
			}
			return types.Bool(match)

View on GitHub (pinned to 50e54ee279)

Solutions

  1. This is an internal error; ensure the CEL matcher factory is one of the supported factory types. Report it if it occurs with stock configuration.

When it happens

Trigger: Thrown at modules/caddyhttp/celmatcher.go:548 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of caddyserver/caddy@50e54ee279 (2026-08-15). Data as JSON: /api/errors/ad3edcb927b022d0. Report an issue: GitHub.