thanos-io/thanos · error
create Prometheus store
Error message
create Prometheus store
What it means
store.NewPrometheusStore failed to construct the Prometheus store proxy (StoreAPI served over gRPC). Construction validates the client and metadata functions; failures are wrapped as 'create Prometheus Store'. This happens before the gRPC server starts, so the sidecar exits.
Solutions
- Correct the --prometheus.url flag value (include scheme, e.g. http://prometheus:9090)
- Check earlier log lines for the underlying error detail; fix what NewPrometheusStore reports
- Ensure you run a thanos version whose sidecar expects the current flag format
- If running patched code, verify the promclient and metadata funcs passed to NewPrometheusStore are non-nil
Example fix
// before --prometheus.url=prometheus.monitoring:9090 # no scheme // after --prometheus.url=http://prometheus.monitoring:9090
Defensive patterns
Strategy: validation
Validate before calling
u, err := url.Parse(promURL)
if err != nil || (u.Scheme != "http" && u.Scheme != "https") {
return fmt.Errorf("--prometheus.url must be an absolute http(s) URL, got %q", promURL)
} Try / catch
promStore, err := store.NewPrometheusStore(...)
if err != nil {
return errors.Wrap(err, "create Prometheus store")
} Prevention
- Always include the scheme in --prometheus.url
- Validate flag URLs at deploy time (Helm/chart linting)
- Keep client constructor arguments non-nil when customizing promclient
- Test sidecar startup in CI with a representative prometheus.url
When it happens
Trigger: errors.Wrap in runSidecar: NewPrometheusStore returned an error — e.g. an invalid --prometheus.url (unparseable/unsupported scheme) passed to the underlying HTTP client construction.
Common situations: Malformed --prometheus.url value (missing scheme, invalid characters); regression when wiring custom client functions; nil metadata functions from a failed earlier step in modified builds.
Understand the failure class
Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.
Related errors
- create bucket compactor
- unable to load config file
- unable to create config reloader
- unable to load config initially
- tracing failed
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/a7944819b1af6a38.
Report an issue: GitHub.
Appendix: source
Thrown at cmd/thanos/sidecar.go:320
}
// Setup the Reloader.
{
ctx, cancel := context.WithCancel(context.Background())
g.Add(func() error {
return reloader.Watch(ctx)
}, func(error) {
cancel()
})
}
// Setup the gRPC server.
{
c := promclient.NewWithTracingClient(logger, httpClient, clientconfig.ThanosUserAgent)
promStore, err := store.NewPrometheusStore(logger, reg, c, conf.prometheus.url, component.Sidecar, m.Labels, m.Timestamps, m.Version)
if err != nil {
return errors.Wrap(err, "create Prometheus store")
}
tlsCfg, err := tls.NewServerConfig(log.With(logger, "protocol", "gRPC"),
conf.grpc.tlsSrvCert, conf.grpc.tlsSrvKey, conf.grpc.tlsSrvClientCA, conf.grpc.tlsMinVersion, conf.grpc.tlsCiphers, conf.grpc.tlsCurves)
if err != nil {
return errors.Wrap(err, "setup gRPC server")
}
exemplarSrv := exemplars.NewPrometheus(conf.prometheus.url, c, m.Labels)
infoSrv := info.NewInfoServer(
component.Sidecar.String(),
info.WithLabelSetFunc(func() []labelpb.ZLabelSet {
return promStore.LabelSet()
}),
info.WithStoreInfoFunc(func() (*infopb.StoreInfo, error) {
if httpProbe.IsReady() {
mint, maxt := m.Timestamps()View on GitHub (pinned to 35b8b99117)