{"record":{"id":"310b96260c002241","repo":"crowdsecurity/crowdsec","slug":"missing-lapi-client-credentials","errorCode":null,"errorMessage":"missing lapi client credentials","messagePattern":"missing lapi client credentials","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/appsec/config.go","lineNumber":201,"sourceCode":"\n\treturn toLoad, nil\n}\n\nfunc (w *Source) Configure(ctx context.Context, yamlConfig []byte, logger *log.Entry, _ metrics.AcquisitionMetricsLevel) error {\n\tif w.hub == nil {\n\t\treturn errors.New(\"appsec datasource requires a hub. this is a bug, please report\")\n\t}\n\n\tif w.lapiClientConfig == nil {\n\t\treturn errors.New(\"appsec datasource requires a lapi client configuration. this is a bug, please report\")\n\t}\n\n\tif err := w.UnmarshalConfig(yamlConfig); err != nil {\n\t\treturn fmt.Errorf(\"unable to parse appsec configuration: %w\", err)\n\t}\n\n\tif w.lapiClientConfig.Credentials == nil {\n\t\treturn errors.New(\"missing lapi client credentials\")\n\t}\n\n\tw.lapiURL = fmt.Sprintf(\"%sv1/decisions/stream\", w.lapiClientConfig.Credentials.URL)\n\tw.AuthCache = NewAuthCache()\n\n\tw.logger = logger\n\tw.logger.Tracef(\"Appsec configuration: %+v\", w.config)\n\n\tif w.config.AuthCacheDuration == nil {\n\t\tw.config.AuthCacheDuration = &DefaultAuthCacheDuration\n\t\tw.logger.Infof(\"Cache duration for auth not set, using default: %v\", *w.config.AuthCacheDuration)\n\t}\n\n\tif w.config.AuthTimeout == nil {\n\t\tw.config.AuthTimeout = &DefaultAuthTimeout\n\t\tw.logger.Infof(\"Auth timeout not set, using default: %v\", *w.config.AuthTimeout)\n\t}\n","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/appsec/config.go#L183-L219","documentation":"After parsing the YAML, Configure() validates that the LAPI client configuration carries Credentials. Without credentials the datasource cannot authenticate to LAPI to fetch decisions for the AppSec component. The YAML must contain a valid url/api_key (or similar) credentials block.","triggerScenarios":"An appsec acquisition config (or the data_source section) whose lapi_client credentials are absent: e.g. missing the credentials URL and API key block, or credentials present but null.","commonSituations":"Hand-written appsec.yaml acquisition file missing the credentials section; copying an appsec datasource snippet that omits lapi credentials; migration from an older config schema where credentials were supplied differently.","solutions":["Add a valid credentials block (url and api_key for your LAPI) to the appsec datasource config","Check for YAML indentation mistakes that nest credentials outside the datasource stanza","Regenerate the datasource config with cscli or from the hub docs to confirm the expected fields"],"exampleFix":"// before (acquisition.yaml)\nsource: appsec\nlisten_addr: 127.0.0.1:7422\n// after\nsource: appsec\nlisten_addr: 127.0.0.1:7422\nlapi_client:\n  credentials:\n    url: http://127.0.0.1:8080\n    api_key: <your-registered-bouncer-key>","handlingStrategy":"validation","validationCode":"if cfg.LapiClient == nil || cfg.LapiClient.Credentials == nil || cfg.LapiClient.Credentials.URL == \"\" {\n    return errors.New(\"appsec datasource needs lapi credentials (url + api_key)\")\n}","typeGuard":null,"tryCatchPattern":"if err := src.Configure(ctx, yaml, logger, lvl); err != nil {\n    if strings.Contains(err.Error(), \"missing lapi client credentials\") { /* fix config */ }\n    return err\n}","preventionTips":["Always include a credentials block with url and api_key in appsec datasource configs","Register a bouncer API key with cscli before writing the config","Validate YAML indentation before starting crowdsec"],"tags":["appsec","lapi","credentials","configuration"],"backgroundTag":"missing-credentials","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"}