rqlite/rqlite · error

query parameter not set

Error message

query parameter not set

What it means

Sentinel validation error raised by NewQueryParams in http/query_params.go:56. After parsing optional duration and integer parameters, it checks the 'q' query parameter: if the key is present but its value is the empty string, the request is rejected with this error. It fires whenever a client explicitly passes an empty 'q' parameter (e.g. '?q=') — the caller (ServeHTTP, forwarded requests, or tests via mustGetQueryParams) receives a nil QueryParams and must surface the error instead of executing a statement. The correct fix is for the client to omit 'q' entirely or supply a non-empty SQL statement.

Source

Thrown at http/query_params.go:56

			_, err := time.ParseDuration(t)
			if err != nil {
				return nil, fmt.Errorf("%s is not a valid duration", k)
			}
		}
	}
	for _, k := range []string{"retries", "trailing_logs"} {
		r, ok := qp[k]
		if ok {
			_, err := strconv.Atoi(r)
			if err != nil {
				return nil, fmt.Errorf("%s is not a valid integer", k)
			}
		}
	}
	q, ok := qp["q"]
	if ok {
		if q == "" {
			return nil, fmt.Errorf("query parameter not set")
		}
	}
	return qp, nil
}

// Timings returns true if the query parameters indicate timings should be returned.
func (qp QueryParams) Timings() bool {
	return qp.HasKey("timings")
}

// Tx returns true if the query parameters indicate the query should be executed in a transaction.
func (qp QueryParams) Tx() bool {
	return qp.HasKey("transaction")
}

// Queue returns true if the query parameters request queued operation
func (qp QueryParams) Queue() bool {
	return qp.HasKey("queue")

View on GitHub (pinned to 7586a4d1bd)

Solutions

  1. Provide a non-empty SQL statement in the q parameter, e.g. ?q=SELECT * FROM foo
  2. Remove the empty q parameter if the statement is sent in the request body instead
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at http/query_params.go:56 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of rqlite/rqlite@7586a4d1bd (2026-09-03). Data as JSON: /api/errors/1a3503a42da4e22c. Report an issue: GitHub.