{"record":{"id":"52f69e84211e6e94","repo":"crowdsecurity/crowdsec","slug":"expected-zero-or-one-value-for-profile","errorCode":null,"errorMessage":"expected zero or one value for 'profile'","messagePattern":"expected zero or one value for 'profile'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/cloudwatch/config.go","lineNumber":240,"sourceCode":"\t\treturn fmt.Errorf(\"while parsing %s: %w\", dsn, err)\n\t}\n\n\tfor k, v := range u {\n\t\tswitch k {\n\t\tcase \"log_level\":\n\t\t\tif len(v) != 1 {\n\t\t\t\treturn errors.New(\"expected zero or one value for 'log_level'\")\n\t\t\t}\n\n\t\t\tlvl, err := log.ParseLevel(v[0])\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"unknown level %s: %w\", v[0], err)\n\t\t\t}\n\n\t\t\ts.logger.Logger.SetLevel(lvl)\n\t\tcase \"profile\":\n\t\t\tif len(v) != 1 {\n\t\t\t\treturn errors.New(\"expected zero or one value for 'profile'\")\n\t\t\t}\n\n\t\t\tawsprof := v[0]\n\t\t\ts.Config.AwsProfile = &awsprof\n\t\t\ts.logger.Debugf(\"profile set to '%s'\", *s.Config.AwsProfile)\n\t\tcase \"start_date\":\n\t\t\tif len(v) != 1 {\n\t\t\t\treturn errors.New(\"expected zero or one argument for 'start_date'\")\n\t\t\t}\n\t\t\t// let's reuse our parser helper so that a ton of date formats are supported\n\t\t\tstrdate, startDate := parser.GenDateParse(v[0])\n\t\t\ts.logger.Debugf(\"parsed '%s' as '%s'\", v[0], strdate)\n\t\t\ts.Config.StartTime = &startDate\n\t\tcase \"end_date\":\n\t\t\tif len(v) != 1 {\n\t\t\t\treturn errors.New(\"expected zero or one argument for 'end_date'\")\n\t\t\t}\n\t\t\t// let's reuse our parser helper so that a ton of date formats are supported","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/cloudwatch/config.go#L222-L258","documentation":"DSN validation in ConfigureByDSN for the cloudwatch source: the profile query parameter (AWS shared-config profile) was repeated in the DSN. The guard requires exactly one value; multiple profiles are ambiguous because only one AwsProfile can be selected for the session.","triggerScenarios":"Thrown at pkg/acquisition/modules/cloudwatch/config.go:240 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass profile=... exactly once in the DSN","If you need a different AWS profile, change the single profile parameter rather than adding another"],"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"}