{"record":{"id":"89ddfcb929a61ee4","repo":"crowdsecurity/crowdsec","slug":"empty-yaml-document","errorCode":null,"errorMessage":"empty yaml document","messagePattern":"empty yaml document","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/acquisition.go","lineNumber":217,"sourceCode":"\t\treturn \"file\", nil\n\tcase slices.Contains(keys, \"filenames\"):\n\t\treturn \"file\", nil\n\tcase slices.Contains(keys, \"journalctl_filter\"):\n\t\treturn \"journalctl\", nil\n\tdefault:\n\t\treturn \"\", nil\n\t}\n}\n\ntype ParsedSourceConfig struct {\n\tCommon           configuration.DataSourceCommonCfg\n\tSource           types.DataSource\n\tTransform        *vm.Program\n\tSourceMissing    bool   // the \"source\" field was missing, and detected\n\tSourceOverridden string // the \"source\" field was not missing, but didn't match the detected one\n}\n\nvar ErrEmptyYAMLDocument = errors.New(\"empty yaml document\")\n\n// ParseSourceConfig validates and configures one YAML document.\n//\n// It does not expand env variables, they must already be expanded.\n//\n// - return sentinel error for empty/comment-only documents\n// - backward-compat source auto-detection (filename/filenames/journalctl_filter)\n// - validate common fields\n// - delegate per-source config validation to the appropriate module\n// - compile transform expression\nfunc ParseSourceConfig(ctx context.Context, yamlDoc []byte, metricsLevel metrics.AcquisitionMetricsLevel, hub *cwhub.Hub) (*ParsedSourceConfig, error) {\n\tdetectedType, err := detectType(bytes.NewReader(yamlDoc))\n\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))","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/acquisition.go#L199-L235","documentation":"Sentinel error ErrEmptyYAMLDocument returned by ParseSourceConfig when csyaml.IsEmptyYAML reports the datasource document contains no keys (only comments or whitespace). It is not a real failure: the acquisition loader explicitly skips documents that return this error (errors.Is check at acquisition.go:369), treating them as intentionally empty stanzas in a multi-document acquis file.","triggerScenarios":"Thrown at pkg/acquisition/acquisition.go:217 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["No action needed if the document is intentionally a placeholder — the loader skips it silently","Remove the empty/comment-only YAML document from acquisition.yaml to silence the skip","If you expected the datasource to load, check it is not commented out or lost its keys during an edit"],"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"}