{"record":{"id":"9fa4ff2e80712747","repo":"crowdsecurity/crowdsec","slug":"missing-labels","errorCode":null,"errorMessage":"missing labels","messagePattern":"missing labels","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/acquisition.go","lineNumber":284,"sourceCode":"\n\tparsed.Common = sub\n\n\t// could not detect, alas\n\tif sub.Source == \"\" {\n\t\treturn nil, errors.New(\"missing 'source' field\")\n\t}\n\n\t// pre-check that the source is valid\n\t_, err = registry.LookupFactory(sub.Source)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// check for labels now, an error for missing labels has lower priority\n\t// than missing or unknown source type\n\tif len(sub.Labels) == 0 && sub.Source != \"docker\" {\n\t\t// docker is the only source that does not require labels\n\t\treturn nil, errors.New(\"missing labels\")\n\t}\n\n\tuniqueID := uuid.NewString()\n\tsub.UniqueId = uniqueID\n\n\tsrc, err := DataSourceConfigure(ctx, sub, yamlDoc, metricsLevel, hub)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"datasource of type %s: %w\", sub.Source, err)\n\t}\n\tparsed.Source = src\n\n\tif sub.TransformExpr != \"\" {\n\t\tvm, err := expr.Compile(sub.TransformExpr, exprhelpers.GetExprOptions(map[string]any{\"evt\": &pipeline.Event{}})...)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"while compiling transform expression '%s' for datasource %s: %w\", sub.TransformExpr, sub.Source, err)\n\t\t}\n\n\t\tparsed.Transform = vm","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/acquisition.go#L266-L302","documentation":"Generic guard in ParseSourceConfig: the datasource stanza carries no 'labels' mapping. Labels are mandatory on every datasource because they feed parser/scenario filtering in the pipeline; docker is the only exception since container labels are discovered at runtime. The check runs after source-type validation so unknown-source errors take priority over this one.","triggerScenarios":"Thrown at pkg/acquisition/acquisition.go:284 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add a labels block to the datasource, e.g.:\n  labels:\n    type: syslog","Ensure the labels key is spelled 'labels' and is a mapping, not a list","Docker sources do not require labels; verify you did not mistype the source type as something else"],"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"}