{"record":{"id":"2c57cc5761c51ca6","repo":"RocketChat/Rocket.Chat","slug":"search-provider-not-found","errorCode":null,"errorMessage":"Search provider not found","messagePattern":"Search provider not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"apps/meteor/client/views/room/contextualBar/MessageSearchTab/hooks/useMessageSearchProviderQuery.ts","lineNumber":12,"sourceCode":"import { useMethod } from '@rocket.chat/ui-contexts';\nimport { useQuery } from '@tanstack/react-query';\n\nexport const useMessageSearchProviderQuery = () => {\n\tconst getSearchProvider = useMethod('rocketchatSearch.getProvider');\n\treturn useQuery({\n\t\tqueryKey: ['search', 'provider'] as const,\n\n\t\tqueryFn: async () => {\n\t\t\tconst provider = await getSearchProvider();\n\t\t\tif (provider === undefined) {\n\t\t\t\tthrow new Error('Search provider not found');\n\t\t\t}\n\n\t\t\treturn provider;\n\t\t},\n\t});\n};\n","sourceCodeStart":1,"sourceCodeEnd":19,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/client/views/room/contextualBar/MessageSearchTab/hooks/useMessageSearchProviderQuery.ts#L1-L19","documentation":"Thrown inside a React Query queryFn when the 'rocketchatSearch.getProvider' method returns undefined. This method queries the server for the configured message search provider (e.g., the default provider, ElasticSearch, or a third-party search app). If no search provider is configured server-side, the method returns undefined, and the queryFn throws to surface the absence.","triggerScenarios":"No search provider is configured in Rocket.Chat server settings. The search provider setting exists but the provider app/plugin is not installed or enabled. The server method returns undefined due to a configuration gap. The search provider was recently uninstalled.","commonSituations":"Fresh Rocket.Chat installation without search configured. Search app (e.g., ElasticSearch integration) was uninstalled or disabled. Server setting 'Search_Provider' is empty or misconfigured. The message search tab is shown but no backend search is available.","solutions":["Configure a search provider in Rocket.Chat server settings (Admin > Settings > Search).","Install and enable a search provider app if using the marketplace-based search.","Guard the UI: only show the message search tab when the query succeeds (not when it errors).","Catch the error in the component and show a 'Search not configured' message instead of the search UI."],"exampleFix":"// before\nconst { data } = useMessageSearchProviderQuery();\n// after: handle missing provider\nconst { data, isError } = useMessageSearchProviderQuery();\nif (isError || !data) {\n  return <Message>Search is not configured. Contact your administrator.</Message>;\n}","handlingStrategy":"validation","validationCode":"const provider = await getSearchProvider();\nif (provider === undefined) {\n  // no search provider configured, do not show search UI\n  return;\n}","typeGuard":"const hasSearchProvider = async (): Promise<boolean> => {\n  const provider = await getSearchProvider();\n  return provider !== undefined;\n};","tryCatchPattern":"const { data, isError } = useMessageSearchProviderQuery();\nif (isError) {\n  // show 'search not configured' instead of search UI\n  return <SearchNotConfigured />;\n}","preventionTips":["Configure a search provider in Rocket.Chat admin settings before enabling the search UI.","Only render the message search tab when the provider query succeeds.","Show a configuration guidance message when the provider is undefined.","Verify the search provider app/plugin is installed and enabled."],"tags":["search","configuration","react-query","server-method","provider"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}