{"record":{"id":"c482b79b46afcad3","repo":"canopy-network/canopy","slug":"field-number-not-found","errorCode":null,"errorMessage":"field number not found","messagePattern":"field number not found","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/codec/codec.go","lineNumber":17,"sourceCode":"package codec\n\nimport (\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"google.golang.org/protobuf/encoding/protowire\"\n\t\"google.golang.org/protobuf/proto\"\n\t\"google.golang.org/protobuf/types/known/anypb\"\n)\n\n// ErrFieldNotFound is returned by GetRawProtoField when the requested field\n// number is absent from the wire bytes. In proto3, absent scalar fields\n// represent the zero value, so callers that expect zero-valued fields\n// (e.g. Pool{Id:0}, Account{Address:nil}) should detect this via errors.Is\n// and treat the field as empty rather than as a parse error.\nvar ErrFieldNotFound = errors.New(\"field number not found\")\n\n// BinaryCodec is an interface model that defines the requirements for binary encoding and decoding\n// A binary encoder converts data into a compact, non-human-readable binary format, which is highly\n// efficient in terms of both storage size and speed for serialization and deserialization\ntype BinaryCodec interface {\n\tMarshal(message any) ([]byte, error)\n\tUnmarshal(data []byte, ptr any) error\n\tToAny(proto.Message) (*anypb.Any, error)\n\tFromAny(*anypb.Any) (proto.Message, error)\n}\n\n// JSONCodec is an interface model that defines requirements for json encoding and decoding\n// converts data into a human-readable text format (JSON) which can be more friendly but less performant\ntype JSONCodec interface {\n\tjson.Marshaler\n\tjson.Unmarshaler\n}\n","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/canopy-network/canopy/blob/ee8197d91dd410f6592cb650a94c925ee6dc8bad/lib/codec/codec.go#L1-L35","documentation":"Sentinel error ErrFieldNotFound returned by codec.GetRawProtoField when the requested field number is absent from the protobuf wire bytes. In proto3 an absent scalar field is the zero value, so this is not a parse failure; callers detect it with errors.Is and treat the field as empty (as fsm/indexer.go:466 does, returning \"\", nil). The wrapped value appended at lib/codec/codec.go:118 is the missing field number.","triggerScenarios":"Thrown at lib/codec/codec.go:17 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use errors.Is(err, codec.ErrFieldNotFound) and treat the field as its zero value instead of failing.","If the field should always exist, inspect the encoded proto to see why the field was omitted (unset in proto3 or wrong field number requested).","Confirm the caller passes the correct field number registered for that proto message."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ee8197d91dd410f6592cb650a94c925ee6dc8bad","analyzedAt":"2026-09-06T09:30:15.973Z","contentChangedAt":"2026-09-06T09:30:15.973Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}