{"record":{"id":"4bbb4e8b497d21ed","repo":"juicedata/juicefs","slug":"set-tier-for-inode-d-failed-w","errorCode":null,"errorMessage":"set tier for inode %d failed: %w","messagePattern":"set tier for inode (.+?) failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/tier.go","lineNumber":333,"sourceCode":"}\nfunc visitEntry(m meta.Meta, format *meta.Format, ino meta.Ino, attr meta.Attr, objectFunc func(key string) error, metaFunc func(ino meta.Ino) error, checkFunc func(ino meta.Ino, oriTier uint8) bool) error {\n\tif checkFunc != nil && checkFunc(ino, attr.Tier) {\n\t\treturn nil\n\t}\n\tobjs := getObjKeys(m, format, ino, attr.Length)\n\tif objectFunc != nil {\n\t\tfor _, key := range objs {\n\t\t\tif key != \"\" {\n\t\t\t\terr := objectFunc(key)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"apply object action failed in inode:%d key:%v: err:%s\", ino, key, err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif metaFunc != nil {\n\t\tif err := metaFunc(ino); err != nil {\n\t\t\treturn fmt.Errorf(\"set tier for inode %d failed: %w\", ino, err)\n\t\t}\n\t}\n\treturn nil\n}\n","sourceCodeStart":315,"sourceCodeEnd":338,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/cmd/tier.go#L315-L338","documentation":"visitEntry finishes by calling metaFunc(ino) to persist the tier/restore state in metadata. Failure there is wrapped as 'set tier for inode %d failed'. Unlike error 314 (which includes the target tier ID), this variant fires from the generic visitEntry path used by both setTier and objRestore (recursive walks and restore operations), so the wrapped cause may be a metadata update or a restore-flag write failure.","triggerScenarios":"Recursive `juicefs tier`/`juicefs restore` where an entry's metadata update fails — metadata engine outage, concurrent deletion of the inode, or xattr write rejection.","commonSituations":"Bulk tiering across a large tree hits a metadata engine hiccup; files deleted while the walk is in progress; SQL metadata lock timeouts under concurrency.","solutions":["Inspect the %w-wrapped cause for the metadata engine error.","Verify metadata engine health/connectivity and retry.","Re-run the command — it is safe to retry; already-processed entries will simply be re-set.","Check the specific inode still exists if the error persists."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := metaFunc(ino); err != nil {\n    if isRetryable(err) { time.Sleep(backoff); return metaFunc(ino) }\n    return err\n}","preventionTips":["Keep the metadata engine healthy (monitor connections/locks) before bulk tier/restore runs","Re-run the idempotent tier command after transient metadata failures","Avoid heavy concurrent metadata writes during recursive tier walks"],"tags":["tier","metadata","cli","restore"],"backgroundTag":"database-write-failed","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}