{"record":{"id":"464da24e10f85b15","repo":"crowdsecurity/crowdsec","slug":"failed-to-parse-w","errorCode":null,"errorMessage":"failed to parse: %w","messagePattern":"failed to parse: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/acquisition.go","lineNumber":248,"sourceCode":"\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// if there are not keys or only comments, the document will be skipped\n\tempty, err := csyaml.IsEmptyYAML(bytes.NewReader(yamlDoc))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif empty {\n\t\treturn nil, ErrEmptyYAMLDocument\n\t}\n\n\tvar sub configuration.DataSourceCommonCfg\n\n\t// can't be strict here, the doc contains specific datasource config too but we won't collect them now.\n\tif err = yaml.UnmarshalWithOptions(yamlDoc, &sub); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse: %w\", errors.New(yaml.FormatError(err, false, false)))\n\t}\n\n\tparsed := &ParsedSourceConfig{}\n\n\t// report that the user did not specify a source\n\tif sub.Source == \"\" {\n\t\tparsed.SourceMissing = true\n\t}\n\n\t// report that the user specified a source that doesn't match with one detected from the presence of other fields\n\tif detectedType != \"\" {\n\t\tif sub.Source != \"\" && sub.Source != detectedType {\n\t\t\tparsed.SourceOverridden = sub.Source\n\t\t}\n\n\t\tsub.Source = detectedType\n\t}\n","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/acquisition.go#L230-L266","documentation":"ParseSourceConfig failed to unmarshal the common datasource configuration (DataSourceCommonCfg) out of the YAML document. The goccy/go-yaml unmarshalling error is reformatted with yaml.FormatError (non-strict, no source hints) and wrapped as 'failed to parse: %w'. It fires when the document's common fields (source, labels, mode, etc.) have YAML syntax errors or type mismatches — note unmarshalling is intentionally non-strict because datasource-specific keys are collected later.","triggerScenarios":"Thrown at pkg/acquisition/acquisition.go:248 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Validate the datasource stanza with a YAML linter; the wrapped error names the line and problem","Check for tabs instead of spaces, unquoted special characters, or wrong indentation under the datasource block","Ensure scalar fields like mode and source are plain strings, and labels is a mapping of string to string"],"exampleFix":null,"handlingStrategy":"try-catch","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-14T05:17:10.506Z"}