{"record":{"id":"aac87270051e4583","repo":"crowdsecurity/crowdsec","slug":"unexpected-argument-s","errorCode":null,"errorMessage":"unexpected argument %s","messagePattern":"unexpected argument (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/cloudwatch/config.go","lineNumber":278,"sourceCode":"\t\t\ts.logger.Debugf(\"parsed '%s' as '%s'\", v[0], strdate)\n\t\t\ts.Config.EndTime = &endDate\n\t\tcase \"backlog\":\n\t\t\tif len(v) != 1 {\n\t\t\t\treturn errors.New(\"expected zero or one argument for 'backlog'\")\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\tduration, err := time.ParseDuration(v[0])\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"unable to parse '%s' as duration: %w\", v[0], err)\n\t\t\t}\n\n\t\t\ts.logger.Debugf(\"parsed '%s' as '%s'\", v[0], duration)\n\t\t\tstart := time.Now().UTC().Add(-duration)\n\t\t\ts.Config.StartTime = &start\n\t\t\tend := time.Now().UTC()\n\t\t\ts.Config.EndTime = &end\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unexpected argument %s\", k)\n\t\t}\n\t}\n\n\ts.logger.Tracef(\"host=%s\", s.Config.GroupName)\n\ts.logger.Tracef(\"stream=%s\", *s.Config.StreamName)\n\ts.Config.GetLogEventsPagesLimit = &def_GetLogEventsPagesLimit\n\n\tif err := s.newClient(ctx); err != nil {\n\t\treturn err\n\t}\n\n\tif s.Config.StreamName == nil || s.Config.GroupName == \"\" {\n\t\treturn errors.New(\"missing stream or group name\")\n\t}\n\n\tif s.Config.StartTime == nil || s.Config.EndTime == nil {\n\t\treturn errors.New(\"start_date and end_date or backlog are mandatory in one-shot mode\")\n\t}","sourceCodeStart":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/cloudwatch/config.go#L260-L296","documentation":"ConfigureByDSN iterates all DSN parameters and only knows a fixed set (aws_region, log_group, log_stream, log_level, profile, backlog, etc.). Any unrecognized parameter key hits the default branch and returns `unexpected argument <key>`, rejecting the whole datasource configuration. It guards against silently ignoring misspelled options.","triggerScenarios":"ConfigureByDSN called with a DSN containing a key not in the switch, e.g. `cloudwatch://group?stream_name=foo` (correct key is log_stream) or any typo like `region=` instead of `aws_region=`.","commonSituations":"Typos in parameter names, guessing parameter names instead of reading the datasource docs, copying DSN options between different acquisition modules (e.g. docker options used on cloudwatch).","solutions":["Remove or correct the unknown parameter in the DSN","Check the cloudwatch datasource documentation for the exact supported parameter names","Use aws_region (not region), log_group (not group), log_stream (not stream) if those were the intended keys"],"exampleFix":"// before\ncloudwatch://my-group?stream_name=s1&region=us-east-1\n// after\ncloudwatch://my-group?log_stream=s1&aws_region=us-east-1","handlingStrategy":"validation","validationCode":"allowed := map[string]bool{\"aws_region\":true,\"log_group\":true,\"log_stream\":true,\"log_level\":true,\"profile\":true,\"backlog\":true,\"aws_arn\":true,\"to_file\":true}\nfor k := range params {\n    if !allowed[k] { return fmt.Errorf(\"unsupported cloudwatch DSN param %q\", k) }\n}","typeGuard":null,"tryCatchPattern":"if err := ds.ConfigureByDSN(ctx, dsn); err != nil {\n    if strings.HasPrefix(err.Error(), \"unexpected argument\") { /* strip/rename the bad key */ }\n}","preventionTips":["Copy DSNs from the official cloudwatch datasource docs","Never reuse DSN keys across different acquisition modules","Validate the full acquisition config with crowdsec before restart"],"tags":["config","aws","cloudwatch","unsupported-parameter"],"backgroundTag":"invalid-argument-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"}