{"record":{"id":"48c228bfb833b1d8","repo":"thanos-io/thanos","slug":"unknown-partial-response-strategy-v","errorCode":null,"errorMessage":"unknown partial response strategy %v","messagePattern":"unknown partial response strategy (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/promclient/promclient.go","lineNumber":412,"sourceCode":"\nfunc (p *QueryOptions) AddTo(values url.Values) error {\n\tvalues.Add(\"dedup\", fmt.Sprintf(\"%v\", p.Deduplicate))\n\tif len(p.MaxSourceResolution) > 0 {\n\t\tvalues.Add(\"max_source_resolution\", p.MaxSourceResolution)\n\t}\n\n\tvalues.Add(\"explain\", fmt.Sprintf(\"%v\", p.Explain))\n\tvalues.Add(\"analyze\", fmt.Sprintf(\"%v\", p.Analyze))\n\tvalues.Add(\"engine\", p.Engine)\n\n\tvar partialResponseValue string\n\tswitch p.PartialResponseStrategy {\n\tcase storepb.PartialResponseStrategy_WARN:\n\t\tpartialResponseValue = strconv.FormatBool(true)\n\tcase storepb.PartialResponseStrategy_ABORT:\n\t\tpartialResponseValue = strconv.FormatBool(false)\n\tdefault:\n\t\treturn errors.Errorf(\"unknown partial response strategy %v\", p.PartialResponseStrategy)\n\t}\n\n\t// TODO(bwplotka): Apply change from bool to strategy in Query API as well.\n\tvalues.Add(\"partial_response\", partialResponseValue)\n\n\treturn nil\n}\n\ntype Explanation struct {\n\tName     string         `json:\"name\"`\n\tChildren []*Explanation `json:\"children,omitempty\"`\n}\n\n// QueryInstant performs an instant query using a default HTTP client and returns results in model.Vector type.\nfunc (c *Client) QueryInstant(ctx context.Context, base *url.URL, query string, t time.Time, opts QueryOptions) (model.Vector, []string, *Explanation, error) {\n\tparams, err := url.ParseQuery(base.RawQuery)\n\tif err != nil {\n\t\treturn nil, nil, nil, errors.Wrapf(err, \"parse raw query %s\", base.RawQuery)","sourceCodeStart":394,"sourceCodeEnd":430,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/promclient/promclient.go#L394-L430","documentation":"QueryOptions.AddTo maps the PartialResponseStrategy enum onto the partial_response query parameter; only WARN and ABORT are supported. Any other (invalid or unexpected) strategy value makes it return this error, and QueryInstant/QueryRange propagate it. It protects against silently issuing a query with an unrecognized strategy.","triggerScenarios":"Passing QueryOptions with PartialResponseStrategy set to a value outside storepb.PartialResponseStrategy_WARN/ABORT — e.g. a zero-value enum from an unvalidated struct, or a strategy added in a newer storepb version not handled by this code.","commonSituations":"Constructing QueryOptions programmatically where the strategy comes from config parsing that does not validate the enum; copying options from another code path that uses a different enum type; upgrading Thanos and forgetting to handle new enum members in a switch.","solutions":["Set PartialResponseStrategy explicitly to storepb.PartialResponseStrategy_WARN or _ABORT before querying","Validate/normalize the strategy value when it originates from config or user input","Rebuild against the current storepb package so enum values match","Inspect the %v value in the error to identify which invalid constant was passed"],"exampleFix":"// before\nopts := promclient.QueryOptions{} // zero-value strategy\n// after\nopts := promclient.QueryOptions{PartialResponseStrategy: storepb.PartialResponseStrategy_WARN}","handlingStrategy":"validation","validationCode":"switch opts.PartialResponseStrategy {\ncase storepb.PartialResponseStrategy_WARN, storepb.PartialResponseStrategy_ABORT:\n    // ok\ndefault:\n    return fmt.Errorf(\"unsupported strategy: %v\", opts.PartialResponseStrategy)\n}","typeGuard":"func validStrategy(s storepb.PartialResponseStrategy) bool {\n    return s == storepb.PartialResponseStrategy_WARN || s == storepb.PartialResponseStrategy_ABORT\n}","tryCatchPattern":"if err := opts.AddTo(params); err != nil {\n    if strings.Contains(err.Error(), \"unknown partial response strategy\") {\n        opts.PartialResponseStrategy = storepb.PartialResponseStrategy_WARN\n        return opts.AddTo(params)\n    }\n    return err\n}","preventionTips":["Always set PartialResponseStrategy explicitly; never rely on zero values","Normalize enum values when loading from config","Recheck switch statements over the enum after Thanos upgrades"],"tags":["enum","query","thanos"],"backgroundTag":"invalid-enum-value","analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}