{"record":{"id":"bd140dc0676cb010","repo":"gofiber/fiber","slug":"binder-msgpack-is-not-configured-please-check-do","errorCode":null,"errorMessage":"binder: msgpack is not configured, please check docs: https://docs.gofiber.io/next/guide/advance-format#msgpack","messagePattern":"binder: msgpack is not configured, please check docs: https://docs\\.gofiber\\.io/next/guide/advance-format#msgpack","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"binder/msgpack.go","lineNumber":9,"sourceCode":"package binder\n\nimport (\n\t\"errors\"\n\n\t\"github.com/gofiber/utils/v2\"\n)\n\nvar ErrMsgPackNotConfigured = errors.New(\"binder: msgpack is not configured, please check docs: https://docs.gofiber.io/next/guide/advance-format#msgpack\")\n\n// MsgPackBinding is the MsgPack binder for MsgPack request body.\ntype MsgPackBinding struct {\n\tMsgPackDecoder utils.MsgPackUnmarshal\n}\n\n// Name returns the binding name.\nfunc (*MsgPackBinding) Name() string {\n\treturn \"msgpack\"\n}\n\n// Bind parses the request body as MsgPack and returns the result.\nfunc (b *MsgPackBinding) Bind(body []byte, out any) error {\n\treturn b.MsgPackDecoder(body, out)\n}\n\n// Reset resets the MsgPackBinding binder.\nfunc (b *MsgPackBinding) Reset() {","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/gofiber/fiber/blob/a105acad6c1e4576a77f01e02973f67e962bb58d/binder/msgpack.go#L1-L27","documentation":"Returned by binder.UnimplementedMsgpackMarshal/Unmarshal (binder/msgpack.go:34, :40), the default MsgPackEncoder/MsgPackDecoder on App.Config. Like CBOR, MsgPack is opt-in: Fiber does not bundle a codec, so any MsgPack bind or response write fires this sentinel until a real marshaler is configured.","triggerScenarios":"A request arrives with Content-Type: application/vnd.msgpack and c.Bind().MsgPack() is called; or c.MsgPack().Send() without Config.MsgPackEncoder set; or Bind.Body() dispatches to the MsgPack branch (bind.go:417-418) while the default is still in place.","commonSituations":"Forgetting to wire MsgPack when adding a MsgPack-producing client; version upgrade where MsgPack defaults changed; sharing a handler between JSON and MsgPack clients without configuring the latter.","solutions":["Set app.Config().MsgPackEncoder and app.Config().MsgPackDecoder to a real implementation (e.g. github.com/vmihailenco/msgpack/v5) at New() time.","If MsgPack is unsupported, return 415 from middleware when Content-Type is application/vnd.msgpack.","For the HTTP client, configure the client's MsgPack codec via its setter before issuing MsgPack requests.","Add a startup assertion that Config.MsgPackDecoder != binder.UnimplementedMsgpackUnmarshal."],"exampleFix":"// before\napp := fiber.New()\n// c.Bind().MsgPack(&out) -> ErrMsgPackNotConfigured\n\n// after\nimport \"github.com/vmihailenco/msgpack/v5\"\napp := fiber.New(fiber.Config{\n    MsgPackEncoder: msgpack.Marshal,\n    MsgPackDecoder: msgpack.Unmarshal,\n})","handlingStrategy":"validation","validationCode":"func assertMsgPackConfigured(app *fiber.App) error {\n    if reflect.ValueOf(app.Config().MsgPackDecoder).Pointer() == reflect.ValueOf(binder.UnimplementedMsgpackUnmarshal).Pointer() {\n        return errors.New(\"msgpack not configured\")\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err := c.Bind().MsgPack(&out); err != nil {\n    if errors.Is(err, binder.ErrMsgPackNotConfigured) {\n        return c.Status(fiber.StatusNotImplemented).SendString(\"msgpack not configured\")\n    }\n    return err\n}","preventionTips":["Set MsgPackEncoder/MsgPackDecoder in fiber.Config at startup.","Reject application/vnd.msgpack requests until configured.","Mirror the assertion in a startup self-test."],"tags":["msgpack","binding","configuration","fiber"],"backgroundTag":null,"analyzedSha":"a105acad6c1e4576a77f01e02973f67e962bb58d","analyzedAt":"2026-08-11T17:33:26.942Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}