{"record":{"id":"a03d0df21fc6898c","repo":"pocketbase/pocketbase","slug":"search-query-is-not-set","errorCode":null,"errorMessage":"search query is not set","messagePattern":"search query is not set","errorType":"validation","errorClass":"ErrEmptyQuery","httpStatus":400,"severity":"error","filePath":"tools/search/provider.go","lineNumber":39,"sourceCode":"\t// DefaultFilterExprLimit specifies the default filter expressions limit.\n\tDefaultFilterExprLimit int = 200\n\n\t// DefaultSortExprLimit specifies the default sort expressions limit.\n\tDefaultSortExprLimit int = 8\n\n\t// MaxPerPage specifies the max allowed search result items returned in a single page.\n\tMaxPerPage int = 1000\n\n\t// MaxFilterLength specifies the max allowed individual search filter parsable length.\n\tMaxFilterLength int = 3500\n\n\t// MaxSortFieldLength specifies the max allowed individual sort field parsable length.\n\tMaxSortFieldLength int = 255\n)\n\n// Common search errors.\nvar (\n\tErrEmptyQuery           = errors.New(\"search query is not set\")\n\tErrSortExprLimit        = errors.New(\"max sort expressions limit reached\")\n\tErrFilterExprLimit      = errors.New(\"max filter expressions limit reached\")\n\tErrFilterLengthLimit    = errors.New(\"max filter length limit reached\")\n\tErrSortFieldLengthLimit = errors.New(\"max sort field length limit reached\")\n)\n\n// URL search query params\nconst (\n\tPageQueryParam      string = \"page\"\n\tPerPageQueryParam   string = \"perPage\"\n\tSortQueryParam      string = \"sort\"\n\tFilterQueryParam    string = \"filter\"\n\tSkipTotalQueryParam string = \"skipTotal\"\n)\n\n// Result defines the returned search result structure.\ntype Result struct {\n\tItems      any `json:\"items\"`","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/pocketbase/pocketbase/blob/5d217ddb50cb144d80a5d0b0bdf11b52b2c3e457/tools/search/provider.go#L21-L57","documentation":"Error \"search query is not set\" thrown in pocketbase/pocketbase.","triggerScenarios":"Thrown when a search provider query is executed without the search query (filter/sort input) being set.","commonSituations":"The provider is executed before its query string is assigned. Initialize the provider with a non-empty query before calling Exec.","solutions":["Set a non-empty search query before executing the search request.","If the query comes from user input, trim and validate it, and reject empty submissions client-side."],"exampleFix":"q := strings.TrimSpace(input)\nif q == \"\" {\n    return errors.New(\"search query is required\")\n}\nresults, err := provider.Search(q)","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5d217ddb50cb144d80a5d0b0bdf11b52b2c3e457","analyzedAt":"2026-08-15T10:06:33.165Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}