{"record":{"id":"b624e00e4d26312a","repo":"thanos-io/thanos","slug":"create-meta-fetcher","errorCode":null,"errorMessage":"create meta fetcher","messagePattern":"create meta fetcher","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/thanos/compact.go","lineNumber":250,"sourceCode":"\tduplicateBlocksFilter := block.NewDeduplicateFilter(conf.blockMetaFetchConcurrency)\n\tnoCompactMarkerFilter := compact.NewGatherNoCompactionMarkFilter(logger, insBkt, conf.blockMetaFetchConcurrency)\n\tnoDownsampleMarkerFilter := downsample.NewGatherNoDownsampleMarkFilter(logger, insBkt, conf.blockMetaFetchConcurrency)\n\tlabelShardedMetaFilter := block.NewLabelShardedMetaFilter(relabelConfig, conf.dedupReplicaLabels...)\n\tconsistencyDelayMetaFilter := block.NewConsistencyDelayMetaFilter(logger, conf.consistencyDelay, extprom.WrapRegistererWithPrefix(\"thanos_\", reg))\n\ttimePartitionMetaFilter := block.NewTimePartitionMetaFilter(conf.filterConf.MinTime, conf.filterConf.MaxTime)\n\n\tvar blockLister block.Lister\n\tswitch syncStrategy(conf.blockListStrategy) {\n\tcase concurrentDiscovery:\n\t\tblockLister = block.NewConcurrentLister(logger, insBkt)\n\tcase recursiveDiscovery:\n\t\tblockLister = block.NewRecursiveLister(logger, insBkt)\n\tdefault:\n\t\treturn errors.Errorf(\"unknown sync strategy %s\", conf.blockListStrategy)\n\t}\n\tbaseMetaFetcher, err := block.NewBaseFetcher(logger, conf.blockMetaFetchConcurrency, insBkt, blockLister, conf.dataDir, extprom.WrapRegistererWithPrefix(\"thanos_\", reg))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"create meta fetcher\")\n\t}\n\n\tenableVerticalCompaction := conf.enableVerticalCompaction\n\tdedupReplicaLabels := strutil.ParseFlagLabels(conf.dedupReplicaLabels)\n\tif len(dedupReplicaLabels) > 0 {\n\t\tenableVerticalCompaction = true\n\t\tlevel.Info(logger).Log(\n\t\t\t\"msg\", \"deduplication.replica-label specified, enabling vertical compaction\", \"dedupReplicaLabels\", strings.Join(dedupReplicaLabels, \",\"),\n\t\t)\n\t}\n\tif enableVerticalCompaction {\n\t\tlevel.Info(logger).Log(\n\t\t\t\"msg\", \"vertical compaction is enabled\", \"compact.enable-vertical-compaction\", fmt.Sprintf(\"%v\", conf.enableVerticalCompaction),\n\t\t)\n\t}\n\tvar (\n\t\tapi = blocksAPI.NewBlocksAPI(logger, conf.webConf.disableCORS, conf.label, flagsMap, insBkt)\n\t\tsy  *compact.Syncer","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/cmd/thanos/compact.go#L232-L268","documentation":"Wraps an error from block.NewBaseFetcher, which sets up the metadata fetcher that downloads and validates block meta.json files into conf.dataDir. Typical underlying causes are failure to create the local data dir (permissions, disk full) or invalid concurrency settings.","triggerScenarios":"block.NewBaseFetcher returns non-nil because it cannot create/prepare conf.dataDir (permission denied, read-only filesystem, ENOSPC) or internal initialization fails.","commonSituations":"Data dir on a read-only volume or with wrong ownership; disk quota exceeded; dataDir pointing at an existing non-directory file.","solutions":["Inspect the wrapped cause in logs and fix the underlying dataDir problem (permissions, space).","Ensure conf.dataDir is a writable directory path.","Check disk usage/free space on the volume backing dataDir."],"exampleFix":"// before\nchown -R root:root /data  # dataDir not writable by thanos user\n// after\nchown -R thanos:thanos /data && chmod u+rwX /data","handlingStrategy":"validation","validationCode":"if fi, err := os.Stat(dataDir); err != nil || !fi.IsDir() {\n    return fmt.Errorf(\"data-dir %q must be an existing directory\", dataDir)\n}\nif err := os.MkdirAll(path.Join(dataDir, \"test-probe\"), 0o755); err != nil {\n    return fmt.Errorf(\"data-dir not writable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := runCompact(...); err != nil {\n    if strings.Contains(err.Error(), \"create meta fetcher\") {\n        // check dataDir permissions/space before retrying\n    }\n    return err\n}","preventionTips":["Pre-provision and chown the data dir in the container entrypoint or StatefulSet init container","Monitor disk usage on the data volume","Run the compact process as a dedicated user with write access to dataDir"],"tags":["filesystem","startup","object-storage"],"backgroundTag":"file-write-failed","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"}