juicedata/juicefs · error
failed to find message %s's type: %v
Error message
failed to find message %s's type: %v
What it means
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.
Source
Thrown at pkg/meta/backup.go:96
var errBakEOF = fmt.Errorf("reach backup EOF")
func getMessageFromType(typ int) (proto.Message, error) {
var name protoreflect.FullName
if typ == segTypeFormat {
name = proto.MessageName(&pb.Format{})
} else if typ < segTypeMax {
name = proto.MessageName(&pb.Batch{})
}
if name == "" {
return nil, fmt.Errorf("unknown message type %d", typ)
}
return createMessageByName(name)
}
func createMessageByName(name protoreflect.FullName) (proto.Message, error) {
typ, err := protoregistry.GlobalTypes.FindMessageByName(name)
if err != nil {
return nil, fmt.Errorf("failed to find message %s's type: %v", name, err)
}
return typ.New().Interface(), nil
}
// BakFormat: BakSegment... + BakEOS + BakFooter
type BakFormat struct {
Pos uint64
Footer *BakFooter
}
func newBakFormat() *BakFormat {
return &BakFormat{
Footer: &BakFooter{
Msg: &pb.Footer{
Magic: BakMagic,
Version: BakVersion,
Infos: make(map[string]*pb.Footer_SegInfo),
},View on GitHub (pinned to c9a67b23e8)
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
Defensive patterns
Strategy: fallback
Validate before calling
// ensure pb types are registered in custom builds import _ "github.com/juicedata/juicefs/pkg/meta/pb"
Try / catch
msg, err := createMessageByName(name)
if err != nil {
return nil, fmt.Errorf("unsupported backup format (rebuild with full pb registration): %w", err)
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- unknown message type %d
- failed to get startTS, which is required for TiKV to ensure
- failed to marshal segment %s: %v
- failed to marshal footer: %w
- failed to read footer: err %w, read len %d, expect len %d
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/114de09877af1474.
Report an issue: GitHub.