thanos-io/thanos · error · api.ApiError
' ' parameter
Error message
'%s' parameter
What it means
parseEnableDedupParam reads the 'deduplication' query/form parameter and parses it with strconv.ParseBool. On failure the error is wrapped as "'deduplication' parameter: ..." and returned as ErrorBadData. It means the deduplication value was not a recognized boolean literal.
Solutions
- Send an exact Go boolean string: 'true', 'false', '1', '0', 't', 'f', 'T', 'F', 'TRUE', 'FALSE' etc.
- Omit the parameter entirely to use the default (dedup enabled)
- Sanitize/trim the value in the client before appending it to the URL
- Check for duplicated params where a later bad value overwrites a good one
Example fix
// before GET /api/v1/query?query=up&deduplication=Yes // after GET /api/v1/query?query=up&deduplication=true
Defensive patterns
Strategy: validation
Validate before calling
const boolRe = /^(true|false|1|0|t|f|T|F|TRUE|FALSE|True|False)$/;
function toBoolParam(v) { if (!boolRe.test(v)) throw new Error(`bad bool: ${v}`); return v.toLowerCase() === 'true' || v === '1' || v.toLowerCase() === 't'; } Type guard
function isGoBool(v) { return ['true','false','1','0','t','f'].includes(String(v).toLowerCase()); } Try / catch
try {
const res = await fetch(url);
const body = await res.json();
if (body.status === 'error' && body.errorType === 'bad_data') throw new Error(body.error);
} catch (e) {
if (/deduplication.*parameter/.test(e.message)) { /* fix the boolean and retry */ }
throw e;
} Prevention
- Only emit Go-parseable booleans for bool query params
- Trim and coerce config values (yes/no/on) before URL building
- Omit optional bool params rather than guessing values
- Add a shared URL-builder that validates bool params
When it happens
Trigger: Passing deduplication=yes/1?/on variants unsupported by ParseBool, e.g. deduplication=Yes, deduplication=truee, deduplication=2, or whitespace-padded values on query, query_range, series, or their explain endpoints.
Common situations: Constructing URLs in scripts where the value comes from untyped config or user input; YAML/JSON configs using truthy values like 'yes' that are not Go booleans; URL encoding issues inserting stray characters.
Understand the failure class
Background: "Invalid query parameter" / "Failed to parse value of ...": fixing bad query string parameters across APIs — this error's family across 36 libraries.
Related errors
- ' ' bad engine
- negative ' ' is not accepted. Try a positive integer
- ULID is not valid
- not supported marker
- parse form
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/d4b79b4d247dc18f.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/api/query/v1.go:300
// operator that fetches data from storage.
type fanoutEntry struct {
EndpointAddr string `json:"endpointAddr,omitempty"`
Duration string `json:"duration,omitempty"`
BytesProcessed int64 `json:"bytesProcessed,omitempty"`
NumResponses int64 `json:"numResponses,omitempty"`
Series int64 `json:"series,omitempty"`
Chunks int64 `json:"chunks,omitempty"`
Samples int64 `json:"samples,omitempty"`
}
func (qapi *QueryAPI) parseEnableDedupParam(r *http.Request) (enableDeduplication bool, _ *api.ApiError) {
enableDeduplication = true
if val := r.FormValue(DedupParam); val != "" {
var err error
enableDeduplication, err = strconv.ParseBool(val)
if err != nil {
return false, &api.ApiError{Typ: api.ErrorBadData, Err: errors.Wrapf(err, "'%s' parameter", DedupParam)}
}
}
return enableDeduplication, nil
}
func (qapi *QueryAPI) parseQueryParam(r *http.Request) string {
return r.FormValue(QueryParam)
}
func (qapi *QueryAPI) parseEngineParam(r *http.Request) (e PromqlEngineType, _ *api.ApiError) {
param := PromqlEngineType(r.FormValue(EngineParam))
if param == "" {
param = qapi.defaultEngine
}
switch param {
case PromqlEnginePrometheus, PromqlEngineThanos:
default:
return param, &api.ApiError{Typ: api.ErrorBadData, Err: errors.Errorf("'%s' bad engine", param)}View on GitHub (pinned to 35b8b99117)