{"record":{"id":"b9527aa159e339b7","repo":"crowdsecurity/crowdsec","slug":"cannot-parse-s","errorCode":null,"errorMessage":"cannot parse: %s","messagePattern":"cannot parse: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/http/config.go","lineNumber":44,"sourceCode":"\tListenAddr                        string            `yaml:\"listen_addr\"`\n\tListenSocket                      string            `yaml:\"listen_socket\"`\n\tPath                              string            `yaml:\"path\"`\n\tAuthType                          string            `yaml:\"auth_type\"`\n\tBasicAuth                         *BasicAuthConfig  `yaml:\"basic_auth\"`\n\tHeaders                           map[string]string `yaml:\"headers\"`\n\tTLS                               *TLSConfig        `yaml:\"tls\"`\n\tCustomStatusCode                  *int              `yaml:\"custom_status_code\"`\n\tCustomHeaders                     map[string]string `yaml:\"custom_headers\"`\n\tMaxBodySize                       *int64            `yaml:\"max_body_size\"`\n\tTimeout                           *time.Duration    `yaml:\"timeout\"`\n\tconfiguration.DataSourceCommonCfg                   `yaml:\",inline\"`\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\n\terr := cfg.Validate()\n\tif err != nil {\n\t\treturn cfg, err\n\t}\n\n\treturn cfg, nil\n}\n\ntype BasicAuthConfig struct {\n\tUsername string `yaml:\"username\"`\n\tPassword string `yaml:\"password\"`\n}\n\ntype TLSConfig struct {","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/http/config.go#L26-L62","documentation":"The HTTP acquisition module parses its YAML configuration with yaml.UnmarshalWithOptions(..., yaml.Strict()), so any unknown field, wrong type, or malformed YAML is rejected and returned as \"cannot parse: %s\" with the formatted yaml error. This is strict schema validation of the acquisition config.","triggerScenarios":"yaml.UnmarshalWithOptions with Strict() fails in ConfigurationFromYAML (called via UnmarshalConfig) — unknown keys, bad indentation, wrong value types.","commonSituations":"Typos in config keys (e.g. 'listen_adress' instead of 'listen_address'); tab characters instead of spaces; unsupported fields copied from an older/newer crowdsec version; wrong nesting of tls/auth_type options.","solutions":["Read the formatted yaml error after 'cannot parse: ' — it names the exact line and offending field.","Fix the key name/indentation to match the documented http acquisition schema for your crowdsec version.","Replace tabs with spaces in the YAML file.","Check `cscli hub list`/docs for the schema version: fields added in newer releases fail on older binaries and vice versa."],"exampleFix":"// before\nsource: http\nlisten_adress: 127.0.0.1  # typo\n// after\nsource: http\nlisten_address: 127.0.0.1","handlingStrategy":"validation","validationCode":"# lint YAML and check schema keys before deploying\npython3 -c \"import yaml,sys; yaml.safe_load(open(sys.argv[1]))\" acquis.yaml\ngrep -nE 'listen_adress|tabbed' acquis.yaml","typeGuard":null,"tryCatchPattern":"// surface the underlying yaml error detail\nif err := parse(cfg); err != nil {\n    log.Fatalf(\"acquis config: %v\", err) // includes line/field from yaml.FormatError\n}","preventionTips":["Validate acquisition YAML against the documented http schema for your crowdsec version.","Use spaces, never tabs, in acquis.yaml.","Diff config keys against the official docs when upgrading crowdsec versions.","Test config with cscli/hubtool before service restart."],"tags":["yaml","configuration","http","validation"],"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"}