{"record":{"id":"8d5d5fb21a20855c","repo":"thanos-io/thanos","slug":"load-tenant-limits-config","errorCode":null,"errorMessage":"load tenant limits config","messagePattern":"load tenant limits config","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/receive/limiter.go","lineNumber":103,"sourceCode":"\t\t\t},\n\t\t)\n\t\tlimiter.configReloadFailedCounter = promauto.With(limiter.registerer).NewCounter(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tNamespace: \"thanos\",\n\t\t\t\tSubsystem: \"receive\",\n\t\t\t\tName:      \"limits_config_reload_err_total\",\n\t\t\t\tHelp:      \"How many times the limit configuration failed to reload.\",\n\t\t\t},\n\t\t)\n\t}\n\n\tif configFile == nil {\n\t\treturn limiter, nil\n\t}\n\n\tlimiter.configPathOrContent = configFile\n\tif err := limiter.loadConfig(); err != nil {\n\t\treturn nil, errors.Wrap(err, \"load tenant limits config\")\n\t}\n\n\treturn limiter, nil\n}\n\n// StartConfigReloader starts the automatic configuration reloader based off of\n// the file indicated by pathOrContent. It starts a Go routine in the given\n// *run.Group.\nfunc (l *Limiter) StartConfigReloader(ctx context.Context) error {\n\tif !l.CanReload() {\n\t\treturn nil\n\t}\n\n\treturn extkingpin.PathContentReloader(ctx, l.configPathOrContent, l.logger, func() {\n\t\tlevel.Info(l.logger).Log(\"msg\", \"reloading limit config\")\n\t\tif err := l.loadConfig(); err != nil {\n\t\t\tif failedReload := l.configReloadCounter; failedReload != nil {\n\t\t\t\tfailedReload.Inc()","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/receive/limiter.go#L85-L121","documentation":"NewLimiter wraps any failure from limiter.loadConfig() — reading and parsing the tenant limits file or content — with the message 'load tenant limits config'. The root cause is in the wrapped error (file missing, unreadable, or invalid YAML/JSON), and the limiter fails to initialize.","triggerScenarios":"Calling NewLimiter with a configFile path or content whose loadConfig() fails: the file does not exist, lacks read permission, or contains invalid limit config.","commonSituations":"Wrong path passed to the receiver's limit-config flag; file not mounted into the pod/container; config file not yet generated at startup; permissions changed after deployment.","solutions":["Check the wrapped (%v) cause: if file-not-found, fix the --receive-limit-config path or mount the file","Verify the file is readable by the process user (permissions, SELinux/container securityContext)","Validate the config content parses (run ParseLimitConfigContent / a YAML linter) before startup","If config is optional, pass nil/empty so NewLimiter skips loading (configFile == nil path)","Set up StartConfigReloader only after NewLimiter succeeds; fix config before restart"],"exampleFix":"// before\nlimiter, err := NewLimiter(hashrings, backend, limitsConfigPath, ...)\n// if limitsConfigPath is wrong: load tenant limits config: open /etc/thanos/limits.yml: no such file\n// after\nif _, err := os.Stat(limitsConfigPath); err != nil {\n    log.Fatalf(\"limit config missing: %v\", err)\n}\nlimiter, err := NewLimiter(hashrings, backend, limitsConfigPath, ...)","handlingStrategy":"try-catch","validationCode":"if limitCfgPath != \"\" {\n    if _, err := os.Stat(limitCfgPath); err != nil {\n        return nil, fmt.Errorf(\"limits config path invalid: %w\", err)\n    }\n}","typeGuard":null,"tryCatchPattern":"limiter, err := receive.NewLimiter(hashrings, bkt, cfgPath, limits, log)\nif err != nil {\n    return fmt.Errorf(\"starting receiver limiter: %w\", err) // inspect wrapped cause\n}","preventionTips":["Mount the limits config file and verify existence in the entrypoint script","Fail readiness checks until the limiter initializes","Pass nil when no limit config is intended"],"tags":["config","startup","limiter"],"backgroundTag":"config-file-not-found","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"}