thanos-io/thanos · error

get content of limit configuration

Error message

get content of limit configuration

What it means

runReceive loads the optional receive root-limit configuration file through conf.writeLimitsConfig.Content(). If reading the file content fails (unreadable path, permission issue, IO error), the error is wrapped with 'get content of limit configuration' and receive startup aborts.

Solutions

  1. Verify the path given to --receive.limits-config exists and is readable by the thanos process (ls -l / cat it as the same user).
  2. In Kubernetes, ensure the ConfigMap/Secret volume containing limits.yaml is mounted before thanos starts.
  3. Fix file permissions (chmod/chown) or run the container with a user that can read the file.
  4. If limits are not needed, remove --receive.limits-config entirely so this code path is skipped.

Example fix

// before
thanos receive --receive.limits-config=/etc/thanos/limits.yaml  # file missing
// after
thanos receive --receive.limits-config=/etc/thanos/limits.yaml  # after mounting the file at that path
Defensive patterns

Strategy: validation

Validate before calling

if _, err := os.Stat(limitsPath); err != nil { return fmt.Errorf("limits config not readable: %w", err) }
if _, err := os.ReadFile(limitsPath); err != nil { return err }

Try / catch

if err := run(); err != nil {
  if strings.Contains(err.Error(), "get content of limit configuration") {
    log.Errorf("check --receive.limits-config path/mount: %v", err)
  }
}

Prevention

When it happens

Trigger: Starting `thanos receive` with a non-empty --receive.limits-config pointing to a file that cannot be read: missing file, wrong permissions, mount not yet available, or the config provider failing to fetch content.

Common situations: Typo in the path passed to --receive.limits-config; Kubernetes ConfigMap volume not mounted yet at container start; file deleted/renamed; permissions restricted for the thanos user.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07). Data as JSON: /api/errors/87a2e6a5ab8aedc4. Report an issue: GitHub.

Appendix: source

Thrown at cmd/thanos/receive.go:263

		reg,
		tsdbOpts,
		lset,
		conf.tenantLabelName,
		bkt,
		conf.allowOutOfOrderUpload,
		conf.skipCorruptedBlocks,
		hashFunc,
		multiTSDBOptions...,
	)
	writer := receive.NewWriter(log.With(logger, "component", "receive-writer"), dbs, &receive.WriterOptions{
		TooFarInFutureTimeWindow: int64(time.Duration(*conf.tsdbTooFarInFutureTimeWindow)),
	})

	var limitsConfig *receive.RootLimitsConfig
	if conf.writeLimitsConfig != nil {
		limitsContentYaml, err := conf.writeLimitsConfig.Content()
		if err != nil {
			return errors.Wrap(err, "get content of limit configuration")
		}
		limitsConfig, err = receive.ParseRootLimitConfig(limitsContentYaml)
		if err != nil {
			return errors.Wrap(err, "parse limit configuration")
		}
	}
	limiter, err := receive.NewLimiter(conf.writeLimitsConfig, reg, receiveMode, log.With(logger, "component", "receive-limiter"), conf.limitsConfigReloadTimer)
	if err != nil {
		return errors.Wrap(err, "creating limiter")
	}

	webHandler := receive.NewHandler(log.With(logger, "component", "receive-handler"), &receive.Options{
		Writer:               writer,
		ListenAddress:        conf.rwAddress,
		Registry:             reg,
		Endpoint:             conf.endpoint,
		TenantHeader:         conf.tenantHeader,
		TenantField:          conf.tenantField,

View on GitHub (pinned to 35b8b99117)