{"record":{"id":"087cac6b841fe9f4","repo":"crowdsecurity/crowdsec","slug":"plugins-are-enabled-but-config-paths-plugin-dir-i","errorCode":null,"errorMessage":"plugins are enabled, but config_paths.plugin_dir is not defined","messagePattern":"plugins are enabled, but config_paths\\.plugin_dir is not defined","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apiserver/apiserver.go","lineNumber":530,"sourceCode":"\tfor _, profile := range profiles {\n\t\tif len(profile.Notifications) != 0 {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\nfunc (s *APIServer) InitPlugins(ctx context.Context, cConfig *csconfig.Config, pluginBroker *csplugin.PluginBroker) error {\n\tif hasPlugins(s.cfg.Profiles) {\n\t\tlog.Info(\"initiating plugin broker\")\n\t\t// On windows, the plugins are always run as medium-integrity processes, so we don't care about plugin_config\n\t\tif cConfig.PluginConfig == nil && runtime.GOOS != \"windows\" {\n\t\t\treturn errors.New(\"plugins are enabled, but the plugin_config section is missing in the configuration\")\n\t\t}\n\n\t\tif cConfig.ConfigPaths.PluginDir == \"\" {\n\t\t\treturn errors.New(\"plugins are enabled, but config_paths.plugin_dir is not defined\")\n\t\t}\n\n\t\terr := pluginBroker.Init(ctx, cConfig.PluginConfig, s.cfg.Profiles, cConfig.ConfigPaths)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"plugin broker: %w\", err)\n\t\t}\n\n\t\tlog.Info(\"initiated plugin broker\")\n\t\ts.AttachPluginBroker(pluginBroker)\n\t}\n\n\treturn nil\n}\n\nfunc (s *APIServer) InitController() error {\n\terr := s.controller.Init()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"controller init: %w\", err)","sourceCodeStart":512,"sourceCodeEnd":548,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/apiserver/apiserver.go#L512-L548","documentation":"When profiles use plugins, the broker must know where plugin binaries live; that path comes from config_paths.plugin_dir. If the profiles reference plugins but plugin_dir is empty, InitPlugins cannot locate them and returns this error.","triggerScenarios":"api.server.profiles contain notifications but config_paths.plugin_dir is unset, misspelled (e.g. plugin-dir), or the config_paths section was dropped from config.yaml.","commonSituations":"Minimal/hand-written configs, packaging mistakes where the default config_paths block was removed, path renamed in a config migration.","solutions":["Set config_paths.plugin_dir in config.yaml (usually /usr/lib/crowdsec/plugins/).","Fix typos so the key is exactly plugin_dir under config_paths.","Remove notification plugins from profiles if plugins are not used."],"exampleFix":"# before\nconfig_paths:\n  data_dir: /var/lib/crowdsec/data/\n# after\nconfig_paths:\n  data_dir: /var/lib/crowdsec/data/\n  plugin_dir: /usr/lib/crowdsec/plugins/","handlingStrategy":"validation","validationCode":"if len(cfg.API.Server.Profiles) > 0 && cfg.ConfigPaths.PluginDir == \"\" {\n    return errors.New(\"config_paths.plugin_dir required when profiles use plugins\")\n}","typeGuard":null,"tryCatchPattern":"if err := server.InitPlugins(ctx, cfg, broker); err != nil {\n    log.Fatalf(\"plugin init: %v\", err)\n}","preventionTips":["Keep the config_paths block intact when editing config.yaml.","Check plugin_dir exists after install (distro packages place it under /usr/lib/crowdsec/plugins).","Validate config before restart."],"tags":["plugins","configuration","paths"],"backgroundTag":"missing-required-config-field","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"}