{"record":{"id":"87a9fb263bc33275","repo":"thanos-io/thanos","slug":"no-external-labels-configured-uniquely-identifyin","errorCode":null,"errorMessage":"no external labels configured, uniquely identifying external labels must be configured; see https://thanos.io/tip/thanos/storage.md#external-labels for details.","messagePattern":"no external labels configured, uniquely identifying external labels must be configured; see https://thanos\\.io/tip/thanos/storage\\.md#external-labels for details\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/thanos/tools_bucket.go","lineNumber":1465,"sourceCode":"\n\t\tlevel.Warn(logger).Log(\"msg\", \"GLOBAL COMPACTOR SHOULD __NOT__ BE RUNNING ON THE SAME BUCKET\")\n\n\t\tif err := compact.ApplyRetentionPolicyByResolution(ctx, logger, insBkt, sy.Metas(), retentionByResolution, stubCounter); err != nil {\n\t\t\treturn errors.Wrap(err, \"retention failed\")\n\t\t}\n\t\treturn nil\n\t})\n}\n\nfunc registerBucketUploadBlocks(app extkingpin.AppClause, objStoreConfig *extflag.PathOrContent) {\n\tcmd := app.Command(\"upload-blocks\", \"Upload blocks push blocks from the provided path to the object storage.\")\n\n\ttbc := &bucketUploadBlocksConfig{}\n\ttbc.registerBucketUploadBlocksFlag(cmd)\n\n\tcmd.Setup(func(g *run.Group, logger log.Logger, reg *prometheus.Registry, _ opentracing.Tracer, _ <-chan struct{}, _ bool) error {\n\t\tif len(tbc.labels) == 0 {\n\t\t\treturn 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.\")\n\t\t}\n\n\t\tlset, err := parseFlagLabels(tbc.labels)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"unable to parse external labels\")\n\t\t}\n\t\tif err := promclient.IsDirAccessible(tbc.path); err != nil {\n\t\t\treturn errors.Wrapf(err, \"unable to access path '%s'\", tbc.path)\n\t\t}\n\n\t\tconfContentYaml, err := objStoreConfig.Content()\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"unable to parse objstore config\")\n\t\t}\n\n\t\tbkt, err := client.NewBucket(logger, confContentYaml, component.Upload.String(), nil)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"unable to create bucket\")","sourceCodeStart":1447,"sourceCodeEnd":1483,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/cmd/thanos/tools_bucket.go#L1447-L1483","documentation":"A hard setup validation in registerBucketUploadBlocks: uploading blocks to object storage requires uniquely identifying external labels (at minimum a block 'name'-like label set), because blocks without them cannot be uniquely identified. If no --label flags are given, the command aborts before doing anything with this error.","triggerScenarios":"Running `thanos tools bucket upload` (upload blocks) without any --label flag, i.e. tbc.labels is empty.","commonSituations":"Scripting the upload tool and forgetting to pass labels used elsewhere (e.g. cluster/replica), or copying a command line that omitted labels.","solutions":["Pass at least one external label, e.g. --label <key>=\"<value>\" (commonly something like cluster or name).","Ensure labels uniquely identify the uploader in your deployment (mirrors thanos sidecar requirements)."],"exampleFix":"// before\nthanos tools bucket upload --objstore.config-file=bucket.yaml ./promdata\n// after\nthanos tools bucket upload --objstore.config-file=bucket.yaml --label cluster=\"us-east-1\" ./promdata","handlingStrategy":"validation","validationCode":"// Shell: fail fast if labels were not provided\nif [ -z \"$LABELS\" ]; then\n  echo \"error: --label is required for bucket upload\" >&2\n  exit 1\nfi\nthanos tools bucket upload --objstore.config-file=bucket.yaml $LABELS ./promdata","typeGuard":null,"tryCatchPattern":"if err := cmd.Run(); err != nil {\n    if strings.Contains(err.Error(), \"no external labels configured\") {\n        log.Fatal(\"pass at least one --label key=\\\"value\\\" flag\")\n    }\n}","preventionTips":["Bake required --label flags into wrapper scripts/crafted CLI profiles.","Use the same unique label set as the sidecar for that Prometheus instance.","Add CI checks that reject deployment scripts invoking upload without labels."],"tags":["configuration","cli","external-labels"],"backgroundTag":"missing-required-flag","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"}