{"record":{"id":"c5dbd68a57c83374","repo":"thanos-io/thanos","slug":"parse-limit-configuration-c5dbd6","errorCode":null,"errorMessage":"parse limit configuration","messagePattern":"parse limit configuration","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/receive/limiter.go","lineNumber":209,"sourceCode":"func (l *Limiter) WriteGate() gate.Gate {\n\tl.RLock()\n\tdefer l.RUnlock()\n\treturn l.writeGate\n}\n\n// ParseLimitConfigContent parses the limit configuration from the path or\n// content.\nfunc ParseLimitConfigContent(limitsConfig fileContent) (*RootLimitsConfig, error) {\n\tif limitsConfig == nil {\n\t\treturn &RootLimitsConfig{}, nil\n\t}\n\tlimitsContentYaml, err := limitsConfig.Content()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"get content of limit configuration\")\n\t}\n\tparsedConfig, err := ParseRootLimitConfig(limitsContentYaml)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"parse limit configuration\")\n\t}\n\treturn parsedConfig, nil\n}\n","sourceCodeStart":191,"sourceCodeEnd":213,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/receive/limiter.go#L191-L213","documentation":"ParseLimitConfigContent wraps failures of ParseRootLimitConfig — parsing the YAML bytes into RootLimitsConfig — with 'parse limit configuration'. The content was read successfully but is not valid YAML or does not match the expected limit config schema.","triggerScenarios":"Calling ParseLimitConfigContent with content that fails ParseRootLimitConfig: invalid YAML syntax, wrong types for limit fields (e.g. string where int expected), or unknown/invalid schema fields when strict parsing is on.","commonSituations":"Hand-edited YAML with bad indentation or tabs; schema drift after upgrading (renamed limit fields); pasting JSON into a strict YAML parser path; template variables left unresolved in the file.","solutions":["Read the wrapped error for the exact YAML line/column or field that failed validation","Run the file through a YAML linter and fix syntax (indentation, tabs, stray characters)","Compare fields against the current RootLimitsConfig schema for the binary version; remove/rename obsolete keys","Render/resolve any templating before loading so raw placeholders don't reach the parser","Add a CI check that parses the limits config with ParseRootLimitConfig before deployment"],"exampleFix":"// before\ntenants:\n  tenant-a:\n    max_head_series: \"abc\"   # string, expected int\n// after\ntenants:\n  tenant-a:\n    max_head_series: 1000000","handlingStrategy":"validation","validationCode":"func validateLimitsYAML(data []byte) error {\n    var raw map[string]interface{}\n    if err := yaml.Unmarshal(data, &raw); err != nil {\n        return fmt.Errorf(\"limits YAML invalid: %w\", err)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"cfg, err := receive.ParseLimitConfigContent(content)\nif err != nil {\n    return nil, fmt.Errorf(\"check limits file YAML and field names: %w\", err)\n}","preventionTips":["Lint limits YAML in CI with the same parser","Pin schema fields to the binary version; diff on upgrades","Resolve templates before parsing; avoid tabs in YAML"],"tags":["config","yaml","validation","limiter"],"backgroundTag":"yaml-parse-error","analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}