{"record":{"id":"6d6e147d411d9ecf","repo":"crowdsecurity/crowdsec","slug":"crowdsec-configuration-not-loaded-while-initializi","errorCode":null,"errorMessage":"crowdsec configuration not loaded while initializing appsec - this is a bug, plese report","messagePattern":"crowdsec configuration not loaded while initializing appsec - this is a bug, plese report","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/acquisition.go","lineNumber":94,"sourceCode":"\t}\n\n\tclog := logging.SubLogger(log.StandardLogger(), \"acquisition.\"+commonConfig.Source, commonConfig.LogLevel)\n\tsubLogger := clog.WithField(\"type\", commonConfig.Source)\n\n\tif commonConfig.Name != \"\" {\n\t\tsubLogger = subLogger.WithField(\"name\", commonConfig.Name)\n\t}\n\n\tsubLogger.Info(\"Configuring datasource\")\n\n\tif hubAware, ok := dataSrc.(types.HubAware); ok {\n\t\thubAware.SetHub(hub)\n\t}\n\n\tif lapiClientAware, ok := dataSrc.(types.LAPIClientAware); ok {\n\t\tcConfig := csconfig.GetConfig()\n\t\tif cConfig.API == nil {\n\t\t\treturn nil, errors.New(\"crowdsec configuration not loaded while initializing appsec - this is a bug, plese report\")\n\t\t}\n\t\tlapiClientAware.SetClientConfig(cConfig.API.Client)\n\t}\n\n\t/* configure the actual datasource */\n\tif err := dataSrc.Configure(ctx, yamlConfig, subLogger, metricsLevel); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn dataSrc, nil\n}\n\nfunc LoadAcquisitionFromDSN(\n\tctx context.Context,\n\tdsn string,\n\tlabels map[string]string,\n\ttransformExpr string,\n\thub *cwhub.Hub,","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/acquisition.go#L76-L112","documentation":"Raised in DataSourceConfigure when an appsec datasource implements LAPIClientAware but the global crowdsec configuration (csconfig.GetConfig().API) is nil, so no LAPI client can be built for it. This is a bug sentinel: it means the acquisition subsystem was started without the API configuration having been loaded first — an internal initialization-order defect, not a user config error.","triggerScenarios":"Thrown at pkg/acquisition/acquisition.go:94 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Do not attempt to configure acquisition before the API config is loaded; ensure the crowdsec config load runs before DataSourceConfigure","If you see this as a user, report it — the message itself says 'this is a bug, please report'","Check that the appsec datasource is not being instantiated by a code path (e.g. cscli or tests) that never loads csconfig.API"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}