crowdsecurity/crowdsec · error

load error (simulation): %w

Error message

load error (simulation): %w

What it means

LoadCrowdsec loads the simulation configuration file after acquisition files are collected. If LoadSimulation returns an error (unreadable or malformed simulation.yaml), it is wrapped as 'load error (simulation): %w' and aborts agent startup.

Source

Thrown at pkg/csconfig/crowdsec_service.go:143

		if err := ensureAbsolutePath(p); err != nil {
			return err
		}
	}

	acquisitionFiles, err := c.Crowdsec.CollectAcquisitionFiles()

	switch {
	case errors.Is(err, ErrNoAcquisitionDefined):
		log.Warning(err)
		c.Crowdsec.AcquisitionFiles = []string{}
	case err != nil:
		return err
	default:
		c.Crowdsec.AcquisitionFiles = acquisitionFiles
	}

	if err = c.LoadSimulation(); err != nil {
		return fmt.Errorf("load error (simulation): %w", err)
	}

	if c.Crowdsec.ParserRoutinesCount <= 0 {
		c.Crowdsec.ParserRoutinesCount = 1
	}

	if c.Crowdsec.BucketsRoutinesCount <= 0 {
		c.Crowdsec.BucketsRoutinesCount = 1
	}

	if c.Crowdsec.OutputRoutinesCount <= 0 {
		c.Crowdsec.OutputRoutinesCount = 1
	}

	if err = c.LoadAPIClient(); err != nil {
		return fmt.Errorf("loading api client: %w", err)
	}

View on GitHub (pinned to 909b515798)

Solutions

  1. Check the simulation_path setting points to an existing, readable file
  2. Validate the simulation YAML (e.g. yaml lint) and fix syntax errors
  3. If you don't use simulation, remove simulation_path or restore the default empty file

Example fix

// before
cscli simstate  # fails to start due to broken simulation.yaml
# after
validate/fix /etc/crowdsec/simulation.yaml, then restart crowdsec
Defensive patterns

Strategy: try-catch

Validate before calling

if _, err := os.Stat(simulationPath); err != nil { log.Warnf("simulation file unreadable: %v", err) }

Try / catch

if err := cfg.LoadCrowdsec(); err != nil { if strings.Contains(err.Error(), "load error (simulation)") { log.Warnf("simulation config invalid, continuing without it: %v", err) } else { log.Fatal(err) } }

Prevention

When it happens

Trigger: crowdsec config has simulation_path pointing to a file that is missing, unreadable (permissions), or contains invalid YAML; LoadCrowdsec -> LoadSimulation fails.

Common situations: simulation_path deleted or moved after config referenced it; file edited by hand leaving broken YAML; wrong permissions after running crowdsec as a different user.

Related errors


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