crowdsecurity/crowdsec · error

no appsec_config provided

Error message

no appsec_config provided

What it means

The appsec datasource must be given at least one appsec_config (name referencing a hub item, or inline config). Configure() fails when the parsed YAML contains no appsec_config entries at all — the runtime cannot build the AppSec rules engine without one.

Source

Thrown at pkg/acquisition/modules/appsec/config.go:265

		}
	} else if w.config.AppsecConfig != "" || len(w.config.AppsecConfigs) > 0 {
		entries := w.config.AppsecConfigs
		if w.config.AppsecConfig != "" {
			entries = []string{w.config.AppsecConfig}
		}

		names, err := resolveAppsecConfigEntries(entries, w.hub)
		if err != nil {
			return err
		}

		for _, name := range names {
			if err := appsecCfg.Load(name, w.hub); err != nil {
				return fmt.Errorf("unable to load appsec_config: %w", err)
			}
		}
	} else {
		return errors.New("no appsec_config provided")
	}

	// Now we can set up the logger
	appsecCfg.SetUpLogger()

	appsecRuntime, err := appsecCfg.Build(ctx, w.hub)
	if err != nil {
		return fmt.Errorf("unable to build appsec_config: %w", err)
	}

	if appsecRuntime.NeedWASMVM {
		logger.Info("Initializing WASM runtime for challenge obfuscation")

		challengeOpts, err := challenge.BuildOptions(appsecCfg.Challenge, appsecCfg.Logger)
		if err != nil {
			return fmt.Errorf("unable to build challenge options: %w", err)
		}

View on GitHub (pinned to 909b515798)

Solutions

  1. Add appsec_config: [crowdsecurity/appsec-defaults] (or your own config names) to the appsec datasource config
  2. Fix the key name/typo and ensure it's a non-empty list
  3. Install the referenced appsec configs from the hub with cscli hub update && cscli hub install

Example fix

// before
source: appsec
listen_addr: 127.0.0.1:7422
// after
source: appsec
listen_addr: 127.0.0.1:7422
appsec_config:
  - crowdsecurity/appsec-defaults
Defensive patterns

Strategy: validation

Validate before calling

if len(cfg.AppsecConfigs) == 0 { return errors.New("appsec datasource requires at least one appsec_config") }

Try / catch

if err := src.Configure(ctx, yaml, logger, lvl); err != nil {
    if strings.Contains(err.Error(), "no appsec_config") { /* add appsec_config entry */ }
    return err
}

Prevention

When it happens

Trigger: appsec acquisition config missing the appsec_config key, or providing it with an empty/null value or an empty list, so the else branch errors out.

Common situations: Minimal appsec listener config without rules; typo like appsec_configs or appsec-config; an emptied-out config after removing all hub collections.

Understand the failure class

Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.

Related errors


AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06). Data as JSON: /api/errors/2486f31132dba5a2. Report an issue: GitHub.