crowdsecurity/crowdsec · error

appsec_config or appsec_config_path must be set

Error message

appsec_config or appsec_config_path must be set

What it means

Validation guard in UnmarshalConfig (called from Configure): the appsec datasource was given none of appsec_config, appsec_config_path, or appsec_configs. Without at least one appsec config reference there is no ruleset to load, so configuration is rejected outright.

Source

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

	if w.config.Path == "" {
		w.config.Path = "/"
	}

	if w.config.Path[0] != '/' {
		w.config.Path = "/" + w.config.Path
	}

	if w.config.Mode == "" {
		w.config.Mode = configuration.TAIL_MODE
	}

	// always have at least one appsec routine
	if w.config.Routines == 0 {
		w.config.Routines = 1
	}

	if w.config.AppsecConfig == "" && w.config.AppsecConfigPath == "" && len(w.config.AppsecConfigs) == 0 {
		return errors.New("appsec_config or appsec_config_path must be set")
	}

	if (w.config.AppsecConfig != "" || w.config.AppsecConfigPath != "") && len(w.config.AppsecConfigs) != 0 {
		return errors.New("appsec_config and appsec_config_path are mutually exclusive with appsec_configs")
	}

	if w.config.Name == "" {
		if w.config.ListenSocket != "" && w.config.ListenAddr == "" {
			w.config.Name = w.config.ListenSocket
		}

		if w.config.ListenSocket == "" {
			w.config.Name = fmt.Sprintf("%s%s", w.config.ListenAddr, w.config.Path)
		}
	}

	return nil
}

View on GitHub (pinned to 909b515798)

Solutions

  1. Set appsec_config to a hub-owned appsec config name (e.g. crowdsecurity/virtual-patching), or appsec_config_path to a local file
  2. Alternatively provide a list under appsec_configs to load several configs
  3. Pick exactly one of the three mechanisms — they are alternatives, not accumulations
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/acquisition/modules/appsec/config.go:90 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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