{"record":{"id":"4b0d11d9fd6e463a","repo":"crowdsecurity/crowdsec","slug":"load-error-simulation-w","errorCode":null,"errorMessage":"load error (simulation): %w","messagePattern":"load error \\(simulation\\): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/csconfig/crowdsec_service.go","lineNumber":143,"sourceCode":"\t\tif err := ensureAbsolutePath(p); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tacquisitionFiles, err := c.Crowdsec.CollectAcquisitionFiles()\n\n\tswitch {\n\tcase errors.Is(err, ErrNoAcquisitionDefined):\n\t\tlog.Warning(err)\n\t\tc.Crowdsec.AcquisitionFiles = []string{}\n\tcase err != nil:\n\t\treturn err\n\tdefault:\n\t\tc.Crowdsec.AcquisitionFiles = acquisitionFiles\n\t}\n\n\tif err = c.LoadSimulation(); err != nil {\n\t\treturn fmt.Errorf(\"load error (simulation): %w\", err)\n\t}\n\n\tif c.Crowdsec.ParserRoutinesCount <= 0 {\n\t\tc.Crowdsec.ParserRoutinesCount = 1\n\t}\n\n\tif c.Crowdsec.BucketsRoutinesCount <= 0 {\n\t\tc.Crowdsec.BucketsRoutinesCount = 1\n\t}\n\n\tif c.Crowdsec.OutputRoutinesCount <= 0 {\n\t\tc.Crowdsec.OutputRoutinesCount = 1\n\t}\n\n\tif err = c.LoadAPIClient(); err != nil {\n\t\treturn fmt.Errorf(\"loading api client: %w\", err)\n\t}\n","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/csconfig/crowdsec_service.go#L125-L161","documentation":"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.","triggerScenarios":"crowdsec config has simulation_path pointing to a file that is missing, unreadable (permissions), or contains invalid YAML; LoadCrowdsec -> LoadSimulation fails.","commonSituations":"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.","solutions":["Check the simulation_path setting points to an existing, readable file","Validate the simulation YAML (e.g. yaml lint) and fix syntax errors","If you don't use simulation, remove simulation_path or restore the default empty file"],"exampleFix":"// before\ncscli simstate  # fails to start due to broken simulation.yaml\n# after\nvalidate/fix /etc/crowdsec/simulation.yaml, then restart crowdsec","handlingStrategy":"try-catch","validationCode":"if _, err := os.Stat(simulationPath); err != nil { log.Warnf(\"simulation file unreadable: %v\", err) }","typeGuard":null,"tryCatchPattern":"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) } }","preventionTips":["Keep simulation.yaml valid YAML; run `cscli` startup checks after manual edits","Don't point simulation_path at files managed by templating that may render empty output","Back up simulation.yaml before rotating configs"],"tags":["config","yaml","simulation","startup"],"backgroundTag":"yaml-parse-error","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}