{"record":{"id":"114de09877af1474","repo":"juicedata/juicefs","slug":"failed-to-find-message-s-s-type-v","errorCode":null,"errorMessage":"failed to find message %s's type: %v","messagePattern":"failed to find message (.+?)'s type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/meta/backup.go","lineNumber":96,"sourceCode":"var 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\nfunc newBakFormat() *BakFormat {\n\treturn &BakFormat{\n\t\tFooter: &BakFooter{\n\t\t\tMsg: &pb.Footer{\n\t\t\t\tMagic:   BakMagic,\n\t\t\t\tVersion: BakVersion,\n\t\t\t\tInfos:   make(map[string]*pb.Footer_SegInfo),\n\t\t\t},","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/meta/backup.go#L78-L114","documentation":"After mapping a segment type to a protobuf full name, createMessageByName looks the message descriptor up in the global protobuf type registry. If the message type is not registered in this binary (or the name is malformed), the lookup fails and this wrapped error is returned.","triggerScenarios":"getMessageFromType resolves a name (e.g. juicefs.meta.Format or Batch) that protoregistry.GlobalTypes does not contain — typically because the protobuf types were never registered via proto.RegisterType in this build, or the name is misspelled/mismatched between the segment writer and reader versions.","commonSituations":"Build with pruned/stripped protobuf registrations (custom builds, lite builds); loading a backup written by a different JuiceFS major version whose pb package layout changed; hand-crafted backup files.","solutions":["Rebuild JuiceFS from a complete source tree so pb types are registered (import the pb package, not a lite build)","Use a load tool version matching the backup's producing version","Check that the pb package init registers Format and Batch message types"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// ensure pb types are registered in custom builds\nimport _ \"github.com/juicedata/juicefs/pkg/meta/pb\"","typeGuard":null,"tryCatchPattern":"msg, err := createMessageByName(name)\nif err != nil {\n    return nil, fmt.Errorf(\"unsupported backup format (rebuild with full pb registration): %w\", err)\n}","preventionTips":["Use official full JuiceFS builds, not stripped/lite builds, for load/summary","Keep dump and load on the same version","Import the pb package for its side effects in custom tooling"],"tags":["protobuf","backup","registry","metadata"],"backgroundTag":"class-not-found","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"}