{"record":{"id":"e699eafac2a174ce","repo":"crowdsecurity/crowdsec","slug":"empty-profiles-path","errorCode":null,"errorMessage":"empty profiles path","messagePattern":"empty profiles path","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/csconfig/profiles.go","lineNumber":37,"sourceCode":"// var OnErrorApply = \"apply\"\n// var OnErrorIgnore = \"ignore\"\n\n// Profile structure(s) are used by the local API to \"decide\" what kind of decision should be applied when a scenario with an active remediation has been triggered\ntype ProfileCfg struct {\n\tName          string            `yaml:\"name,omitempty\"`\n\tDebug         *bool             `yaml:\"debug,omitempty\"`\n\tFilters       []string          `yaml:\"filters,omitempty\"` // A list of OR'ed expressions. the models.Alert object\n\tDecisions     []models.Decision `yaml:\"decisions,omitempty\"`\n\tDurationExpr  string            `yaml:\"duration_expr,omitempty\"`\n\tOnSuccess     string            `yaml:\"on_success,omitempty\"` // continue or break\n\tOnFailure     string            `yaml:\"on_failure,omitempty\"` // continue or break\n\tOnError       string            `yaml:\"on_error,omitempty\"`   // continue, break, error, report, apply, ignore\n\tNotifications []string          `yaml:\"notifications,omitempty\"`\n}\n\nfunc (c *LocalApiServerCfg) LoadProfiles() error {\n\tif c.ProfilesPath == \"\" {\n\t\treturn errors.New(\"empty profiles path\")\n\t}\n\n\tpatcher := csyaml.NewPatcher(c.ProfilesPath, \".local\")\n\n\tfcontent, err := patcher.PrependedPatchContent()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treader := bytes.NewReader(fcontent)\n\n\tdec := yaml.NewDecoder(reader)\n\tdec.KnownFields(true)\n\n\tfor {\n\t\tt := ProfileCfg{}\n\n\t\terr = dec.Decode(&t)","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/csconfig/profiles.go#L19-L55","documentation":"LocalApiServerCfg.LoadProfiles needs ProfilesPath (from 'profiles_path' in the API server section) to locate the profiles YAML that defines alert remediation behavior. An empty path means the profiles file was never configured, so loading cannot even start.","triggerScenarios":"api.server section without 'profiles_path:'; calling LoadProfiles on a manually constructed LocalApiServerCfg; a config where the profiles_path key was deleted or never present.","commonSituations":"Hand-rolled LAPI configs; container images assembled from partial config snippets; users upgrading and dropping the profiles_path line.","solutions":["Add 'profiles_path: /etc/crowdsec/profiles.yaml' under api.server in the config file","Create the profiles.yaml file if it does not exist (copy config/profiles.yaml from the repo as a starting point)","Ensure the path points to an existing readable file, since the next step is patching/reading it"],"exampleFix":"// before\napi:\n  server:\n    enabled: true\n\n// after\napi:\n  server:\n    enabled: true\n    profiles_path: /etc/crowdsec/profiles.yaml","handlingStrategy":"validation","validationCode":"if cfg.API.Server != nil && cfg.API.Server.ProfilesPath == \"\" {\n    return fmt.Errorf(\"api.server.profiles_path must be set for LAPI\")\n}","typeGuard":null,"tryCatchPattern":"if err := cfg.API.Server.LoadProfiles(); err != nil {\n    if strings.Contains(err.Error(), \"empty profiles path\") {\n        log.Fatal(\"set api.server.profiles_path in the LAPI config\")\n    }\n    return err\n}","preventionTips":["Always ship profiles.yaml alongside config.yaml in packaged setups","Set profiles_path explicitly rather than relying on defaults","Verify the referenced file exists before starting LAPI"],"tags":["config","lapi","profiles"],"backgroundTag":"missing-config-value","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}