zeromicro/go-zero · error

secret's length can't be less than 8

Error message

secret's length can't be less than 8

What it means

Error "secret's length can't be less than 8" thrown in zeromicro/go-zero.

Source

Thrown at rest/server.go:339

func WithUnsignedCallback(callback handler.UnsignedCallback) RunOption {
	return func(svr *Server) {
		svr.ngin.setUnsignedCallback(callback)
	}
}

func handleError(err error) {
	// ErrServerClosed means the server is closed manually
	if err == nil || errors.Is(err, http.ErrServerClosed) {
		return
	}

	logx.Error(err)
	panic(err)
}

func validateSecret(secret string) {
	if len(secret) < 8 {
		panic("secret's length can't be less than 8")
	}
}

type corsRouter struct {
	httpx.Router
	middleware Middleware
}

func newCorsRouter(router httpx.Router, headerFn func(http.Header), origins ...string) httpx.Router {
	return &corsRouter{
		Router:     router,
		middleware: cors.Middleware(headerFn, origins...),
	}
}

func (c *corsRouter) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	c.middleware(c.Router.ServeHTTP)(w, r)
}

View on GitHub (pinned to 11f21098dd)

When it happens

Trigger: Thrown at rest/server.go:339 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zeromicro/go-zero@11f21098dd (2026-08-15). Data as JSON: /api/errors/9cf8607ccc231637. Report an issue: GitHub.