caddyserver/caddy · error

error initializing CEL library for %T: %v

Error message

error initializing CEL library for %T: %v

What it means

Error "error initializing CEL library for %T: %v" thrown in caddyserver/caddy.

Source

Thrown at modules/caddyhttp/celmatcher.go:157

	for _, info := range caddy.GetModules("http.matchers") {
		p, ok := info.New().(CELLibraryProducer)
		if ok {
			matcherLibProducers = append(matcherLibProducers, p)
		}
	}

	// add the matcher name to the context so that the matcher name
	// can be used by regexp matchers being provisioned
	ctx = ctx.WithValue(MatcherNameCtxKey, m.Name)

	// Assemble the compilation and program options from the different library
	// producers into a single cel.Library implementation.
	matcherEnvOpts := []cel.EnvOption{}
	matcherProgramOpts := []cel.ProgramOption{}
	for _, producer := range matcherLibProducers {
		l, err := producer.CELLibrary(ctx)
		if err != nil {
			return fmt.Errorf("error initializing CEL library for %T: %v", producer, err)
		}
		matcherEnvOpts = append(matcherEnvOpts, l.CompileOptions()...)
		matcherProgramOpts = append(matcherProgramOpts, l.ProgramOptions()...)
	}
	matcherLib := cel.Lib(NewMatcherCELLibrary(matcherEnvOpts, matcherProgramOpts))

	// create the CEL environment
	env, err := cel.NewEnv(
		cel.Function(CELPlaceholderFuncName, cel.SingletonBinaryBinding(m.caddyPlaceholderFunc), cel.Overload(
			CELPlaceholderFuncName+"_httpRequest_string",
			[]*cel.Type{httpRequestObjectType, cel.StringType},
			cel.AnyType,
		)),
		cel.Variable(CELRequestVarName, httpRequestObjectType),
		cel.CustomTypeAdapter(m.ta),
		ext.Strings(),
		ext.Bindings(),
		ext.Lists(),

View on GitHub (pinned to 50e54ee279)

Solutions

  1. Fix the CEL matcher expression; the wrapped error indicates why the CEL library could not be initialized for that matcher type.

When it happens

Trigger: Thrown at modules/caddyhttp/celmatcher.go:157 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/22bf04a5ed998d86. Report an issue: GitHub.