{"record":{"id":"f4b27cea10a1751c","repo":"immich-app/immich","slug":"smart-search-is-not-enabled","errorCode":null,"errorMessage":"Smart search is not enabled","messagePattern":"Smart search is not enabled","errorType":"exception","errorClass":"BadRequestException","httpStatus":400,"severity":"warning","filePath":"server/src/services/search.service.ts","lineNumber":179,"sourceCode":"      visibility: dto.visibility ?? (auth.session?.hasElevatedPermission ? undefined : 'not-locked'),\n      userIds,\n      viewingUserId: auth.user.id,\n    });\n    return items.map((item) => mapAsset(item, { auth }));\n  }\n\n  async searchSmart(auth: AuthDto, dto: SmartSearchDto): Promise<SearchResponseDto> {\n    if (isNewShapeRequest(dto)) {\n      return this.searchSmartV3(auth, dto);\n    }\n\n    if (dto.visibility === AssetVisibility.Locked) {\n      requireElevatedPermission(auth);\n    }\n\n    const { machineLearning } = await this.getConfig({ withCache: false });\n    if (!isSmartSearchEnabled(machineLearning)) {\n      throw new BadRequestException('Smart search is not enabled');\n    }\n\n    const userIds = this.getUserIdsToSearch(auth, dto.visibility);\n    const embedding = await this.resolveEmbedding(auth, dto, machineLearning);\n    const page = dto.page ?? 1;\n    const size = dto.size;\n    const { hasNextPage, items } = await this.searchRepository.searchSmart(\n      { page, size },\n      {\n        ...dto,\n        userIds: await userIds,\n        viewingUserId: auth.user.id,\n        embedding,\n        visibility: dto.visibility ?? (auth.session?.hasElevatedPermission ? undefined : 'not-locked'),\n      },\n    );\n\n    return this.mapResponse(items, { auth }, { nextPage: hasNextPage ? (page + 1).toString() : null });","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/immich-app/immich/blob/e55ac299a4ec7cb372e35dbf2c6c05ee9ce77f6c/server/src/services/search.service.ts#L161-L197","documentation":"searchSmart checks the server's machine-learning config (freshly fetched, uncached) and throws when smart search is disabled. Smart search (CLIP-style semantic embedding search) is an optional feature that must be enabled in server settings.","triggerScenarios":"POST /search/smart (or searchSmart service call) while the server config has machine learning smart search turned off (e.g. ML disabled, or the smart-search endpoint setting off).","commonSituations":"Deployments without a machine-learning container; admins disabled smart search to save resources; self-hosted minimal installs; upgrading where ML was switched off and clients still call smart search.","solutions":["Enable smart search in Administration > Settings > Machine Learning Settings (Smart Search)","Deploy/configure the machine-learning service if it is missing","Fall back to metadata search in clients when smart search is disabled","Gate the smart-search UI behind a server capability check"],"exampleFix":"// before\nconst res = await api.searchSmart({ query: 'dog' }); // throws if disabled\n// after\nif (serverFeatures.smartSearch) {\n  const res = await api.searchSmart({ query: 'dog' });\n} else {\n  const res = await api.searchMetadata({});","handlingStrategy":"fallback","validationCode":"const features = await api.getServerFeatures();\nif (!features.smartSearch) return metadataSearchFallback();","typeGuard":"function smartSearchAvailable(cfg: { machineLearning: { smartSearch?: { enabled: boolean } } }): boolean {\n  return cfg.machineLearning.smartSearch?.enabled === true;\n}","tryCatchPattern":"try {\n  return await searchService.searchSmart(auth, dto);\n} catch (e) {\n  if (e instanceof BadRequestException && e.message === 'Smart search is not enabled') {\n    return searchService.searchMetadata(auth, toMetadataDto(dto));\n  }\n  throw e;\n}","preventionTips":["Gate smart-search UI behind the server features flag","Keep the ML service deployed and enabled if semantic search is needed","Cache server features and refresh on config changes"],"tags":["search","machine-learning","feature-disabled"],"backgroundTag":"feature-not-enabled","analyzedSha":"e55ac299a4ec7cb372e35dbf2c6c05ee9ce77f6c","analyzedAt":"2026-09-15T07:20:19.675Z","contentChangedAt":"2026-09-15T07:20:19.675Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}