{"record":{"id":"bbfe2ec0d26159c8","repo":"crowdsecurity/crowdsec","slug":"cannot-parse-loki-acquisition-configuration-s","errorCode":null,"errorMessage":"cannot parse loki acquisition configuration: %s","messagePattern":"cannot parse loki acquisition configuration: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/loki/config.go","lineNumber":45,"sourceCode":"type Configuration struct {\n\tURL                               string            `yaml:\"url\"`    // Loki url\n\tPrefix                            string            `yaml:\"prefix\"` // Loki prefix\n\tQuery                             string            `yaml:\"query\"`  // LogQL query\n\tLimit                             int               `yaml:\"limit\"`  // Limit of logs to read\n\tDelayFor                          time.Duration     `yaml:\"delay_for\"`\n\tSince                             time.Duration     `yaml:\"since\"`\n\tHeaders                           map[string]string `yaml:\"headers\"`        // HTTP headers for talking to Loki\n\tWaitForReady                      time.Duration     `yaml:\"wait_for_ready\"` // Retry interval, default is 10 seconds\n\tAuth                              AuthConfiguration `yaml:\"auth\"`\n\tMaxFailureDuration                time.Duration     `yaml:\"max_failure_duration\"` // Max duration of failure before stopping the source\n\tNoReadyCheck                      bool              `yaml:\"no_ready_check\"`       // Bypass /ready check before starting\n\tconfiguration.DataSourceCommonCfg                   `yaml:\",inline\"`\n}\n\nfunc (l *Source) UnmarshalConfig(yamlConfig []byte) error {\n\terr := yaml.UnmarshalWithOptions(yamlConfig, &l.Config, yaml.Strict())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot parse loki acquisition configuration: %s\", yaml.FormatError(err, false, false))\n\t}\n\n\tif l.Config.Query == \"\" {\n\t\treturn errors.New(\"loki query is mandatory\")\n\t}\n\n\tif l.Config.WaitForReady == 0 {\n\t\tl.Config.WaitForReady = 10 * time.Second\n\t}\n\n\tif l.Config.DelayFor < 0*time.Second || l.Config.DelayFor > 5*time.Second {\n\t\treturn errors.New(\"delay_for should be a value between 1s and 5s\")\n\t}\n\n\tif l.Config.Mode == \"\" {\n\t\tl.Config.Mode = configuration.TAIL_MODE\n\t}\n","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/loki/config.go#L27-L63","documentation":"UnmarshalConfig for the loki source unmarshals the acquisition YAML into the Configuration struct; malformed YAML or invalid values make the loki acquisition configuration unparseable, so the source is rejected at load time.","triggerScenarios":"Thrown at pkg/acquisition/modules/loki/config.go:45 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix YAML syntax or field type errors reported in the message","Check url, query, limit etc. have the documented types"],"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"}