{"record":{"id":"ea7a584786c7e1ac","repo":"thanos-io/thanos","slug":"bucket-client","errorCode":null,"errorMessage":"bucket client","messagePattern":"bucket client","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"cmd/thanos/tools_bucket.go","lineNumber":665,"sourceCode":"\t\t\t})\n\t\t\trouter = router.WithPrefix(tbc.webRoutePrefix)\n\t\t}\n\n\t\tins := extpromhttp.NewInstrumentationMiddleware(reg, nil)\n\n\t\tbucketUI := ui.NewBucketUI(logger, tbc.webExternalPrefix, tbc.webPrefixHeaderName, component.Bucket)\n\t\tbucketUI.Register(router, ins)\n\n\t\tflagsMap := getFlagsMap(cmd.Flags())\n\n\t\tconfContentYaml, err := objStoreConfig.Content()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tbkt, err := client.NewBucket(logger, confContentYaml, component.Bucket.String(), nil)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"bucket client\")\n\t\t}\n\t\tinsBkt := objstoretracing.WrapWithTraces(objstore.WrapWithMetrics(bkt, extprom.WrapRegistererWithPrefix(\"thanos_\", reg), bkt.Name()))\n\n\t\tapi := v1.NewBlocksAPI(logger, tbc.webDisableCORS, tbc.label, flagsMap, insBkt)\n\n\t\t// Configure Request Logging for HTTP calls.\n\t\topts := []logging.Option{logging.WithDecider(func(_ string, _ error) logging.Decision {\n\t\t\treturn logging.NoLogCall\n\t\t})}\n\t\tlogMiddleware := logging.NewHTTPServerMiddleware(logger, opts...)\n\n\t\tapi.Register(router.WithPrefix(\"/api/v1\"), tracer, logger, ins, logMiddleware)\n\n\t\tsrv.Handle(\"/\", router)\n\n\t\tif tbc.interval < 5*time.Minute {\n\t\t\tlevel.Warn(logger).Log(\"msg\", \"Refreshing more often than 5m could lead to large data transfers\")\n\t\t}","sourceCodeStart":647,"sourceCodeEnd":683,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/cmd/thanos/tools_bucket.go#L647-L683","documentation":"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'.","triggerScenarios":"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).","commonSituations":"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`).","solutions":["Check the wrapped inner error for the provider-specific cause (credentials, endpoint, unknown type).","Validate the YAML with `thanos tools bucket verify` on a minimal config or yamllint first.","Confirm the config file path exists and is readable: --objstore.config-file=/path/to/bucket.yml.","Ensure the `type:` matches a supported provider and its required options are present.","Pass config inline with --objstore.config='type: S3 ...' to rule out file-path issues."],"exampleFix":"// before (missing type)\nconfContentYaml := []byte(\"bucket: my-bucket\")\n// after\nconfContentYaml := []byte(\"type: S3\\nbucket: my-bucket\\nendpoint: s3.amazonaws.com\")","handlingStrategy":"validation","validationCode":"conf, err := objstore.ClientConfig(logger, []byte(cfgYaml))\nif err != nil {\n    return fmt.Errorf(\"objstore config invalid: %w\", err)\n}\nif conf.Type == \"\" {\n    return errors.New(\"objstore config missing type\")\n}","typeGuard":null,"tryCatchPattern":"bkt, err := client.NewBucket(logger, confContentYaml, component.Bucket.String(), nil)\nif err != nil {\n    // surface inner cause: unknown type, bad credentials, etc.\n    return fmt.Errorf(\"check --objstore.config-file: %w\", err)\n}","preventionTips":["Run `thanos tools bucket ls` as a smoke test before heavier commands","Keep bucket.yml under version control and lint it as YAML","Confirm credentials via the provider CLI (aws s3 ls, gsutil ls) with the same account","Match the config schema to your Thanos version after upgrades"],"tags":["object-storage","config","client-init"],"backgroundTag":"invalid-config-value","analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}