{"record":{"id":"8eef0d9fe1c59048","repo":"SigNoz/signoz","slug":"couldn-t-base64-decode-existingfilter-w","errorCode":null,"errorMessage":"couldn't base64 decode existingFilter: %w","messagePattern":"couldn't base64 decode existingFilter: %w","errorType":"http","errorClass":"model.ApiError","httpStatus":400,"severity":"error","filePath":"pkg/query-service/app/parser.go","lineNumber":564,"sourceCode":"\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\texamplesLimit, err := parsePositiveIntQP(\n\t\t\"examplesLimit\",\n\t\tbaseconstants.DefaultFilterSuggestionsExamplesLimit,\n\t\tbaseconstants.MaxFilterSuggestionsExamplesLimit,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar existingFilter *v3.FilterSet\n\texistingFilterB64 := r.URL.Query().Get(\"existingFilter\")\n\tif len(existingFilterB64) > 0 {\n\t\tdecodedFilterJson, err := base64.RawURLEncoding.DecodeString(existingFilterB64)\n\t\tif err != nil {\n\t\t\treturn nil, model.BadRequest(fmt.Errorf(\"couldn't base64 decode existingFilter: %w\", err))\n\t\t}\n\n\t\texistingFilter = &v3.FilterSet{}\n\t\terr = json.Unmarshal(decodedFilterJson, existingFilter)\n\t\tif err != nil {\n\t\t\treturn nil, model.BadRequest(fmt.Errorf(\"couldn't JSON decode existingFilter: %w\", err))\n\t\t}\n\t}\n\n\tsearchText := r.URL.Query().Get(\"searchText\")\n\n\treturn &v3.QBFilterSuggestionsRequest{\n\t\tDataSource:      dataSource,\n\t\tSearchText:      searchText,\n\t\tExistingFilter:  existingFilter,\n\t\tAttributesLimit: attributesLimit,\n\t\tExamplesLimit:   examplesLimit,\n\t}, nil","sourceCodeStart":546,"sourceCodeEnd":582,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/app/parser.go#L546-L582","documentation":"parseQBFilterSuggestionsRequest accepts an optional 'existingFilter' query param that must be base64 (RawURL encoding) of a JSON FilterSet. This error means the base64 decode step itself failed.","triggerScenarios":"Calling the query-builder suggestions endpoint with existingFilter set to a raw JSON string, standard base64 with padding, or corrupted/truncated base64.","commonSituations":"Sending JSON directly without encoding; using base64.StdEncoding with +/= characters instead of URL-safe no-padding encoding; string truncation from URL length limits.","solutions":["Encode with base64.RawURLEncoding (URL-safe, no padding) in Go, or base64url without padding elsewhere","Verify the value wasn't truncated or re-encoded by a proxy","If passing literal JSON, remove the param and send via body if the API version supports it"],"exampleFix":"// before\n?existingFilter={\"operator\":\"AND\",\"items\":[]}\n// after (Go)\nenc := base64.RawURLEncoding.EncodeToString([]byte(filterJSON))\n// use ?existingFilter=<enc>","handlingStrategy":"validation","validationCode":"if _, err := base64.RawURLEncoding.DecodeString(existingFilterB64); err != nil { return fmt.Errorf(\"existingFilter must be base64url without padding\") }","typeGuard":"func isRawURLBase64(s string) bool { _, err := base64.RawURLEncoding.DecodeString(s); return err == nil }","tryCatchPattern":null,"preventionTips":["Always encode with base64.RawURLEncoding in Go","Add an integration test that round-trips encode→decode of the filter"],"tags":["signoz","query-builder","base64","bad-request"],"backgroundTag":"base64-decode-failed","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}