thanos-io/thanos · error
unable to create bucket
Error message
unable to create bucket
What it means
This error is returned when client.NewBucket fails to instantiate the object-storage client from the validated config YAML. NewBucket resolves the provider type and constructs the underlying client (s3, gcs, azure, etc.), failing on unknown providers or client-constructor errors such as bad credentials format. The upload command wraps that failure as 'unable to create bucket'.
Solutions
- Verify the config 'type' matches an exact supported provider name for your thanos version (S3, GCS, AZURE, COS, OSS, BOS, SWIFT, COS, FILESYSTEM)
- Test the same config with a simpler consumer (e.g. thanos tools bucket verify) to surface the underlying constructor error
- Check credentials format: GCS requires a service-account JSON path/content; S3 needs valid access/secret keys
- If using a custom build, confirm the required objstore provider package is compiled in
Example fix
// before (bucket.yaml) type: s3s config: bucket: my-bucket // after # bucket.yaml type: S3 config: bucket: my-bucket endpoint: s3.amazonaws.com
Defensive patterns
Strategy: validation
Validate before calling
confContentYaml, err := objStoreConfig.Content()
if err != nil {
return err
}
// Probe client construction before the real run:
if _, err := client.NewBucket(logger, confContentYaml, "probe", nil); err != nil {
return fmt.Errorf("objstore client construction failed: %w", err)
} Try / catch
if err := runUpload(ctx); err != nil {
if strings.Contains(err.Error(), "unable to create bucket") {
logger.Error(err, "check provider type and credentials in objstore config")
os.Exit(1)
}
return err
} Prevention
- Copy provider config examples from the official thanos docs for your exact version
- Test the bucket config with `thanos tools bucket verify` before production uploads
- Verify provider names are case-correct (S3, GCS, AZURE, ...)
- Ensure your thanos build includes the objstore provider you reference
When it happens
Trigger: objstore config has an unknown/misspelled type (no provider registered under that name), or the provider constructor rejects the config (e.g. invalid endpoint URL, unparsable credentials blob, missing required client option).
Common situations: Typo in provider type like 's3s' or 'gcs' vs 'GCS'; endpoint lacking scheme or pointing to a nonexistent host; malformed credentials JSON for GCS; thanos build compiled without the needed objstore provider support.
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
- failed to parse template
- failed to execute template
- error while parsing config for request logging
- getting http client config
- parsing http config YAML
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/68b5759071ae74ce.
Report an issue: GitHub.
Appendix: source
Thrown at cmd/thanos/tools_bucket.go:1483
return errors.New("no external labels configured, uniquely identifying external labels must be configured; see https://thanos.io/tip/thanos/storage.md#external-labels for details.")
}
lset, err := parseFlagLabels(tbc.labels)
if err != nil {
return errors.Wrap(err, "unable to parse external labels")
}
if err := promclient.IsDirAccessible(tbc.path); err != nil {
return errors.Wrapf(err, "unable to access path '%s'", tbc.path)
}
confContentYaml, err := objStoreConfig.Content()
if err != nil {
return errors.Wrap(err, "unable to parse objstore config")
}
bkt, err := client.NewBucket(logger, confContentYaml, component.Upload.String(), nil)
if err != nil {
return errors.Wrap(err, "unable to create bucket")
}
bkt = objstoretracing.WrapWithTraces(objstore.WrapWithMetrics(bkt, extprom.WrapRegistererWithPrefix("thanos_", reg), bkt.Name()))
tbcDir, err := os.OpenRoot(tbc.path)
if err != nil {
runutil.CloseWithLogOnErr(logger, bkt, "bucket client")
return errors.Wrap(err, "unable to open tbc directory")
}
s := shipper.New(
bkt,
tbcDir,
shipper.WithLogger(logger),
shipper.WithRegisterer(reg),
shipper.WithSource(metadata.BucketUploadSource),
shipper.WithMetaFileName(shipper.DefaultMetaFilename),
shipper.WithLabels(func() labels.Labels { return lset }),View on GitHub (pinned to 35b8b99117)