{"record":{"id":"90d6e4ddbb028f27","repo":"crowdsecurity/crowdsec","slug":"cannot-parse-s-90d6e4","errorCode":null,"errorMessage":"cannot parse: %s","messagePattern":"cannot parse: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/kinesis/config.go","lineNumber":38,"sourceCode":"type Configuration struct {\n\tconfiguration.DataSourceCommonCfg `yaml:\",inline\"`\n\n\tStreamName        string  `yaml:\"stream_name\"`\n\tStreamARN         string  `yaml:\"stream_arn\"`\n\tUseEnhancedFanOut bool    `yaml:\"use_enhanced_fanout\"` // Use RegisterStreamConsumer and SubscribeToShard instead of GetRecords\n\tAwsProfile        *string `yaml:\"aws_profile\"`\n\tAwsRegion         string  `yaml:\"aws_region\"`\n\tAwsEndpoint       string  `yaml:\"aws_endpoint\"`\n\tConsumerName      string  `yaml:\"consumer_name\"`\n\tFromSubscription  bool    `yaml:\"from_subscription\"`\n\tMaxRetries        int     `yaml:\"max_retries\"`\n}\n\nfunc ConfigurationFromYAML(y []byte) (Configuration, error) {\n\tvar cfg Configuration\n\n\tif err := yaml.UnmarshalWithOptions(y, &cfg, yaml.Strict()); err != nil {\n\t\treturn cfg, fmt.Errorf(\"cannot parse: %s\", yaml.FormatError(err, false, false))\n\t}\n\n\tcfg.SetDefaults()\n\tcfg.Normalize()\n\n\terr := cfg.Validate()\n\tif err != nil {\n\t\treturn cfg, err\n\t}\n\n\treturn cfg, nil\n}\n\nfunc (c *Configuration) SetDefaults() {\n\tif c.Mode == \"\" {\n\t\tc.Mode = configuration.TAIL_MODE\n\t}\n}","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/kinesis/config.go#L20-L56","documentation":"ConfigurationFromYAML parses a kinesis acquisition config with goccy/go-yaml in Strict() mode and returns any unmarshal error formatted via yaml.FormatError. Strict mode rejects unknown keys and type mismatches, so this fires on malformed or misspelled kinesis datasource yaml.","triggerScenarios":"yaml.UnmarshalWithOptions(y, &cfg, yaml.Strict()) fails: a key not present in the kinesis Configuration struct (typo like `stream-name` vs `stream_name`, or stray keys), wrong value types (e.g. max_retries: \"ten\"), or invalid yaml syntax.","commonSituations":"Hand-editing /etc/crowdsec/acquis.d/*.yaml with typos; copy-pasting config with tabs instead of spaces; using kafka-style keys (brokers/topic) in a kinesis source; duration strings for int fields.","solutions":["Read the formatted error text — goccy FormatError includes line/column of the offending key","Fix the unknown key or value type; check the Configuration struct fields in pkg/acquisition/modules/kinesis/config.go for exact key names","Validate yaml indentation (spaces, not tabs) and overall syntax with a linter","Keep only supported keys: stream_name, stream_arn, use_enhanced_fanout, aws_profile, aws_region, aws_endpoint, consumer_name, from_subscription, max_retries plus common datasource fields"],"exampleFix":"// before\nsource: kinesis\nstream-name: my-stream   # unknown key in strict mode\n// after\nsource: kinesis\nstream_name: my-stream","handlingStrategy":"validation","validationCode":"allowed := map[string]bool{\"stream_name\":true,\"stream_arn\":true,\"use_enhanced_fanout\":true,\"aws_profile\":true,\"aws_region\":true,\"aws_endpoint\":true,\"consumer_name\":true,\"from_subscription\":true,\"max_retries\":true}\nfor k := range rawYamlKeys {\n    if !allowed[k] { return fmt.Errorf(\"unknown kinesis key: %s\", k) }\n}","typeGuard":null,"tryCatchPattern":"cfg, err := kinesisacquisition.ConfigurationFromYAML(y)\nif err != nil {\n    // goccy FormatError embeds line:col — surface it directly to the operator\n    return fmt.Errorf(\"kinesis acquisition yaml: %v\", err)\n}","preventionTips":["Run crowdsec config validation (cscli) before reload","Use underscores, not hyphens, in kinesis yaml keys","Lint yaml files for tabs and stray keys in CI"],"tags":["kinesis","yaml","config","crowdsec"],"backgroundTag":"yaml-parse-error","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"}