{"record":{"id":"641b00fc9913b6dc","repo":"juicedata/juicefs","slug":"unknown-message-type-d","errorCode":null,"errorMessage":"unknown message type %d","messagePattern":"unknown message type (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/meta/backup.go","lineNumber":88,"sourceCode":"\tsegTypeXattr:     \"xattr\",\n\tsegTypeAcl:       \"acl\",\n\tsegTypeStat:      \"stat\",\n\tsegTypeQuota:     \"quota\",\n\tsegTypeParent:    \"parent\",\n\tsegTypeChangeLog: \"changeLog\",\n}\n\nvar errBakEOF = fmt.Errorf(\"reach backup EOF\")\n\nfunc getMessageFromType(typ int) (proto.Message, error) {\n\tvar name protoreflect.FullName\n\tif typ == segTypeFormat {\n\t\tname = proto.MessageName(&pb.Format{})\n\t} else if typ < segTypeMax {\n\t\tname = proto.MessageName(&pb.Batch{})\n\t}\n\tif name == \"\" {\n\t\treturn nil, fmt.Errorf(\"unknown message type %d\", typ)\n\t}\n\treturn createMessageByName(name)\n}\n\nfunc createMessageByName(name protoreflect.FullName) (proto.Message, error) {\n\ttyp, err := protoregistry.GlobalTypes.FindMessageByName(name)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to find message %s's type: %v\", name, err)\n\t}\n\treturn typ.New().Interface(), nil\n}\n\n// BakFormat: BakSegment... + BakEOS + BakFooter\ntype BakFormat struct {\n\tPos    uint64\n\tFooter *BakFooter\n}\n","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/meta/backup.go#L70-L106","documentation":"When unmarshalling a metadata backup segment, the segment's type byte must map to a known protobuf message name (Format or Batch). If the type byte is out of range or unknown (name resolves to empty), the backup file is corrupt or written by an incompatible version.","triggerScenarios":"Reading a backup/dump file whose segment header contains a type value that is neither segTypeFormat nor < segTypeMax — e.g. a truncated, corrupted, or newer-format backup file passed to Unmarshal.","commonSituations":"Restoring a backup produced by a newer JuiceFS version into an older client; a backup file damaged in transfer (FTP ASCII mode, truncated copy); pointing juicefs load at the wrong file.","solutions":["Regenerate the backup with a matching (same or newer) JuiceFS version","Verify the backup file integrity (checksum, size) and re-transfer in binary mode","Inspect the first bytes of the file to confirm it is a JuiceFS metadata backup and not another format"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before loading, check the file looks like a JuiceFS backup\ninfo, err := os.Stat(bakFile)\nif err != nil || info.Size() < 16 {\n    return fmt.Errorf(\"%s is not a valid JuiceFS backup\", bakFile)\n}","typeGuard":null,"tryCatchPattern":"seg, err := f.Unmarshal(r)\nif err != nil {\n    if strings.Contains(err.Error(), \"unknown message type\") {\n        return fmt.Errorf(\"backup file incompatible or corrupt: %w\", err)\n    }\n    return err\n}","preventionTips":["Transfer backups in binary mode and verify checksums","Match dump/load tool versions","Never hand-edit backup files"],"tags":["metadata","backup","protobuf","corruption"],"backgroundTag":"invalid-enum-value","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"}