{"record":{"id":"1762c12ba8d021a3","repo":"thanos-io/thanos","slug":"unexpected-meta-file-version-d-1762c1","errorCode":null,"errorMessage":"unexpected meta file version %d","messagePattern":"unexpected meta file version (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/shipper/shipper.go","lineNumber":661,"sourceCode":"\tif err := f.Close(); err != nil {\n\t\treturn err\n\t}\n\treturn renameFile(logger, tmp, path)\n}\n\n// ReadMetaFile reads the given meta from <dir>/thanos.shipper.json.\nfunc ReadMetaFile(path string) (*Meta, error) {\n\tb, err := os.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to read %s\", path)\n\t}\n\n\tvar m Meta\n\tif err := json.Unmarshal(b, &m); err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to parse %s as JSON: %q\", path, string(b))\n\t}\n\tif m.Version != MetaVersion1 {\n\t\treturn nil, errors.Errorf(\"unexpected meta file version %d\", m.Version)\n\t}\n\n\treturn &m, nil\n}\n\nfunc renameFile(logger log.Logger, from, to string) error {\n\tif err := os.RemoveAll(to); err != nil {\n\t\treturn err\n\t}\n\tif err := os.Rename(from, to); err != nil {\n\t\treturn err\n\t}\n\n\t// Directory was renamed; sync parent dir to persist rename.\n\tpdir, err := fileutil.OpenDir(filepath.Dir(to))\n\tif err != nil {\n\t\treturn err\n\t}","sourceCodeStart":643,"sourceCodeEnd":679,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/shipper/shipper.go#L643-L679","documentation":"ReadMetaFile validates that the parsed Meta.Version equals MetaVersion1. If the meta file was written with a different (newer or unsupported) version, this error is thrown, refusing to interpret data whose layout it does not understand.","triggerScenarios":"Calling ReadMetaFile/Sync/UploadedBlocks/AreAllBlocksUploaded on a meta.json whose `version` field is not 1 — e.g. a file produced by a newer Thanos release or hand-edited to a different value.","commonSituations":"Upgraded binaries vs. data written by a different version; experimental forks bumping MetaVersion; manual edits of meta.json setting an arbitrary version; mixing storage from different Thanos versions.","solutions":["Check the `version` field in the meta file and restore it to 1 if it was accidentally edited.","Upgrade (or match) the Thanos/shipper version to the one that wrote the meta file.","Regenerate the meta file via a fresh shipper Sync if the data can be re-derived.","Restore the file from backup or the object store copy if it was corrupted."],"exampleFix":"// before (meta.json)\n{\"version\": 2, ...}\n// after\n{\"version\": 1, ...}","handlingStrategy":"validation","validationCode":"b, _ := os.ReadFile(path)\nvar probe struct{ Version int `json:\"version\"` }\nif json.Unmarshal(b, &probe) == nil && probe.Version != 1 {\n    return fmt.Errorf(\"unsupported meta version %d at %s\", probe.Version, path)\n}","typeGuard":null,"tryCatchPattern":"if _, err := shipper.ReadMetaFile(path); err != nil {\n    if strings.Contains(err.Error(), \"unexpected meta file version\") {\n        // handle version mismatch: upgrade binary or restore file\n    }\n}","preventionTips":["Keep all Thanos components on the same version.","Don't edit meta.json version field manually.","Pin shipper versions in deployment manifests.","Test upgrades on copied data before production."],"tags":["versioning","shipper","meta-file","compatibility"],"backgroundTag":"invalid-enum-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"}