gofiber/fiber · error

binder: msgpack is not configured, please check docs…

Error message

binder: msgpack is not configured, please check docs: https://docs.gofiber.io/next/guide/advance-format#msgpack

What it means

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.

Solutions

  1. Set app.Config().MsgPackEncoder and app.Config().MsgPackDecoder to a real implementation (e.g. github.com/vmihailenco/msgpack/v5) at New() time.
  2. If MsgPack is unsupported, return 415 from middleware when Content-Type is application/vnd.msgpack.
  3. For the HTTP client, configure the client's MsgPack codec via its setter before issuing MsgPack requests.
  4. Add a startup assertion that Config.MsgPackDecoder != binder.UnimplementedMsgpackUnmarshal.

Example fix

// before
app := fiber.New()
// c.Bind().MsgPack(&out) -> ErrMsgPackNotConfigured

// after
import "github.com/vmihailenco/msgpack/v5"
app := fiber.New(fiber.Config{
    MsgPackEncoder: msgpack.Marshal,
    MsgPackDecoder: msgpack.Unmarshal,
})
Defensive patterns

Strategy: validation

Validate before calling

func assertMsgPackConfigured(app *fiber.App) error {
    if reflect.ValueOf(app.Config().MsgPackDecoder).Pointer() == reflect.ValueOf(binder.UnimplementedMsgpackUnmarshal).Pointer() {
        return errors.New("msgpack not configured")
    }
    return nil
}

Try / catch

if err := c.Bind().MsgPack(&out); err != nil {
    if errors.Is(err, binder.ErrMsgPackNotConfigured) {
        return c.Status(fiber.StatusNotImplemented).SendString("msgpack not configured")
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of gofiber/fiber@a105acad6c (2026-08-11). Data as JSON: /api/errors/bd140dc0676cb010. Report an issue: GitHub.

Appendix: source

Thrown at binder/msgpack.go:9

package binder

import (
	"errors"

	"github.com/gofiber/utils/v2"
)

var ErrMsgPackNotConfigured = errors.New("binder: msgpack is not configured, please check docs: https://docs.gofiber.io/next/guide/advance-format#msgpack")

// MsgPackBinding is the MsgPack binder for MsgPack request body.
type MsgPackBinding struct {
	MsgPackDecoder utils.MsgPackUnmarshal
}

// Name returns the binding name.
func (*MsgPackBinding) Name() string {
	return "msgpack"
}

// Bind parses the request body as MsgPack and returns the result.
func (b *MsgPackBinding) Bind(body []byte, out any) error {
	return b.MsgPackDecoder(body, out)
}

// Reset resets the MsgPackBinding binder.
func (b *MsgPackBinding) Reset() {

View on GitHub (pinned to a105acad6c)