thanos-io/thanos · error

create index cache

Error message

create index cache

What it means

storecache.NewIndexCache (or the in-memory fallback) failed to build the index cache from the provided config, e.g. invalid in-memory cache sizes or unreachable memcached servers. Store startup aborts.

Solutions

  1. Check index cache config sizes (max-size, max-item-size)
  2. Verify memcached endpoints if using a distributed cache
  3. Fix YAML/schema errors in the index cache config
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cmd/thanos/store.go:373 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at cmd/thanos/store.go:373

	indexCacheContentYaml, err := conf.indexCacheConfigs.Content()
	if err != nil {
		return errors.Wrap(err, "get content of index cache configuration")
	}

	// Create the index cache loading its config from config file, while keeping
	// backward compatibility with the pre-config file era.
	var indexCache storecache.IndexCache
	if len(indexCacheContentYaml) > 0 {
		indexCache, err = storecache.NewIndexCache(logger, indexCacheContentYaml, reg)
	} else {
		indexCache, err = storecache.NewInMemoryIndexCacheWithConfig(logger, nil, reg, storecache.InMemoryIndexCacheConfig{
			MaxSize:     model.Bytes(conf.indexCacheSizeBytes),
			MaxItemSize: storecache.DefaultInMemoryIndexCacheConfig.MaxItemSize,
		})
	}
	if err != nil {
		return errors.Wrap(err, "create index cache")
	}

	var matchersCache = storecache.NoopMatchersCache
	if conf.matcherCacheSize > 0 {
		matchersCache, err = storecache.NewMatchersCache(storecache.WithSize(conf.matcherCacheSize), storecache.WithPromRegistry(reg))
		if err != nil {
			return errors.Wrap(err, "failed to create matchers cache")
		}
	}

	var blockLister block.Lister
	switch syncStrategy(conf.blockListStrategy) {
	case concurrentDiscovery:
		blockLister = block.NewConcurrentLister(logger, insBkt)
	case recursiveDiscovery:
		blockLister = block.NewRecursiveLister(logger, insBkt)
	default:
		return errors.Errorf("unknown sync strategy %s", conf.blockListStrategy)

View on GitHub (pinned to 35b8b99117)