{"record":{"id":"af1ca1e9eac056df","repo":"juicedata/juicefs","slug":"decode-v-s","errorCode":null,"errorMessage":"decode %v: %s","messagePattern":"decode (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/meta/dump.go","lineNumber":634,"sourceCode":"\n\t\t\t\t\tvar t json.Token\n\t\t\t\t\tt, err = dec.Token()\n\t\t\t\t\tif err == nil && t != json.Delim('}') {\n\t\t\t\t\t\terr = fmt.Errorf(\"unexpected %v\", t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase \"symlink\":\n\t\t\terr = dec.Decode(&e.Symlink)\n\t\tcase \"xattrs\":\n\t\t\terr = dec.Decode(&e.Xattrs)\n\t\tcase \"posix_acl_access\":\n\t\t\terr = dec.Decode(&e.AccessACL)\n\t\tcase \"posix_acl_default\":\n\t\t\terr = dec.Decode(&e.DefaultACL)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"decode %v: %s\", name, err)\n\t\t}\n\t}\n\tif len(e.Parents) == 1 {\n\t\tload(&e)\n\t\tbar.Increment()\n\t}\n\tif _, err := dec.Token(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &e, nil\n}\n\nfunc dumpACL(rule *aclAPI.Rule) *DumpedACL {\n\tif rule == nil {\n\t\treturn nil\n\t}\n\treturn &DumpedACL{\n\t\tOwner:  rule.Owner,","sourceCodeStart":616,"sourceCodeEnd":652,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/meta/dump.go#L616-L652","documentation":"While loading a dumped metadata entry, decoding of one of the entry's fields (attributes, symlink target, xattr, or a POSIX ACL) failed. The error wraps the failing field name and the underlying decoder error. It indicates the dump entry contains a value that cannot be decoded into the expected Go type.","triggerScenarios":"The decoder hits a field (e.g. `posix_acl_access`, `posix_acl_default`, `xattrs`, `symlink`) whose JSON value does not match the target struct, or the underlying stream has an IO/JSON error mid-entry; loadFiles returns `decode <name>: <err>`.","commonSituations":"Loading a dump produced by a newer JuiceFS version with fields an older binary can't decode; corrupted dump content for an ACL or xattr; ACL feature data present but the target entry struct type mismatched.","solutions":["Inspect the named field around the reported position in the dump file and fix or remove the malformed value.","Upgrade the juicefs binary doing the load to a version at least as new as the one that produced the dump.","Re-dump from the source metadata engine and retry.","Verify the dump wasn't corrupted in transfer (checksum comparison)."],"exampleFix":"// before: old binary loading dump with new ACL fields\n$ juicefs-v1.0 load sqlite3://meta.db dump-with-acls\n// after\n$ juicefs-v1.2 load sqlite3://meta.db dump-with-acls","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := loadDump(...); err != nil {\n    var de *DecodeError // or inspect the wrapped error\n    if strings.HasPrefix(err.Error(), \"decode \") { /* field-level decode failure: check dump version/fields */ }\n}","preventionTips":["Keep the loading binary version >= the dumping binary version.","Validate dumps against a JSON schema before load.","Test load/restore round-trips in staging before production restores."],"tags":["json","metadata-dump","acl","decoding"],"backgroundTag":"json-unmarshal-failed","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}