thanos-io/thanos · critical

bucket client

Error message

bucket client

What it means

The command builds the object-store client via client.NewBucket using the YAML from --objstore.config-file/--objstore.config. If the config is unparseable, the provider is unknown, or required provider options (credentials, endpoints) are missing/invalid, NewBucket fails and the error is wrapped as 'bucket client'.

Solutions

  1. Check the wrapped inner error for the provider-specific cause (credentials, endpoint, unknown type).
  2. Validate the YAML with `thanos tools bucket verify` on a minimal config or yamllint first.
  3. Confirm the config file path exists and is readable: --objstore.config-file=/path/to/bucket.yml.
  4. Ensure the `type:` matches a supported provider and its required options are present.
  5. Pass config inline with --objstore.config='type: S3 ...' to rule out file-path issues.

Example fix

// before (missing type)
confContentYaml := []byte("bucket: my-bucket")
// after
confContentYaml := []byte("type: S3\nbucket: my-bucket\nendpoint: s3.amazonaws.com")
Defensive patterns

Strategy: validation

Validate before calling

conf, err := objstore.ClientConfig(logger, []byte(cfgYaml))
if err != nil {
    return fmt.Errorf("objstore config invalid: %w", err)
}
if conf.Type == "" {
    return errors.New("objstore config missing type")
}

Try / catch

bkt, err := client.NewBucket(logger, confContentYaml, component.Bucket.String(), nil)
if err != nil {
    // surface inner cause: unknown type, bad credentials, etc.
    return fmt.Errorf("check --objstore.config-file: %w", err)
}

Prevention

When it happens

Trigger: Running a bucket tools command where the objstore config YAML at cmd/thanos/tools_bucket.go:665 fails NewBucket: unknown `type:` value, missing config file, malformed YAML, or provider rejecting its options (e.g. missing S3 access keys, bad GCS project).

Common situations: Wrong path to --objstore.config-file, config produced for a different Thanos/objstore version, missing credentials in the environment, or typos in the type field (e.g. `s3` vs `filesystem`).

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at cmd/thanos/tools_bucket.go:665

			})
			router = router.WithPrefix(tbc.webRoutePrefix)
		}

		ins := extpromhttp.NewInstrumentationMiddleware(reg, nil)

		bucketUI := ui.NewBucketUI(logger, tbc.webExternalPrefix, tbc.webPrefixHeaderName, component.Bucket)
		bucketUI.Register(router, ins)

		flagsMap := getFlagsMap(cmd.Flags())

		confContentYaml, err := objStoreConfig.Content()
		if err != nil {
			return err
		}

		bkt, err := client.NewBucket(logger, confContentYaml, component.Bucket.String(), nil)
		if err != nil {
			return errors.Wrap(err, "bucket client")
		}
		insBkt := objstoretracing.WrapWithTraces(objstore.WrapWithMetrics(bkt, extprom.WrapRegistererWithPrefix("thanos_", reg), bkt.Name()))

		api := v1.NewBlocksAPI(logger, tbc.webDisableCORS, tbc.label, flagsMap, insBkt)

		// Configure Request Logging for HTTP calls.
		opts := []logging.Option{logging.WithDecider(func(_ string, _ error) logging.Decision {
			return logging.NoLogCall
		})}
		logMiddleware := logging.NewHTTPServerMiddleware(logger, opts...)

		api.Register(router.WithPrefix("/api/v1"), tracer, logger, ins, logMiddleware)

		srv.Handle("/", router)

		if tbc.interval < 5*time.Minute {
			level.Warn(logger).Log("msg", "Refreshing more often than 5m could lead to large data transfers")
		}

View on GitHub (pinned to 35b8b99117)