ipfs/kubo · error

parameter 'rate' must be set

Error message

parameter 'rate' must be set

What it means

Debug HTTP endpoint exposed by BlockProfileRateOption (default /debug/blockprofilerate): a POST request arrived without the required 'rate' form parameter. The parameter sets the blocking-profile sampling interval in nanoseconds (0 disables).

Source

Thrown at core/corehttp/mutex_profile.go:64

// using POST request with parameter 'rate'.
// The profiler tries to sample 1 event every <rate> nanoseconds.
// If rate == 1, then the profiler samples every blocking event.
// To disable, set rate = 0.
func BlockProfileRateOption(path string) ServeOption {
	return func(_ *core.IpfsNode, _ net.Listener, mux *http.ServeMux) (*http.ServeMux, error) {
		mux.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) {
			if r.Method != http.MethodPost {
				http.Error(w, "only POST allowed", http.StatusMethodNotAllowed)
				return
			}
			if err := r.ParseForm(); err != nil {
				http.Error(w, err.Error(), http.StatusBadRequest)
				return
			}

			rateStr := r.Form.Get("rate")
			if len(rateStr) == 0 {
				http.Error(w, "parameter 'rate' must be set", http.StatusBadRequest)
				return
			}

			rate, err := strconv.Atoi(rateStr)
			if err != nil {
				http.Error(w, err.Error(), http.StatusBadRequest)
				return
			}
			log.Infof("Setting BlockProfileRate to %d", rate)
			runtime.SetBlockProfileRate(rate)
		})
		return mux, nil
	}
}

View on GitHub (pinned to 329838acdf)

Solutions

  1. Include the rate parameter in the POST, e.g. curl -X POST -d rate=1000 http://127.0.0.1:5001/debug/blockprofilerate
  2. Use rate=0 to disable the profiler
  3. Use POST, not GET; other methods get 405
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at core/corehttp/mutex_profile.go:64 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03). Data as JSON: /api/errors/e0954e3d0262f461. Report an issue: GitHub.