{"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":"http","errorClass":"BadRequestException","httpStatus":400,"severity":"warning","filePath":"server/src/services/search.service.ts","lineNumber":150,"sourceCode":"    }\n\n    const userIds = await this.getUserIdsToSearch(auth, dto.visibility);\n    const items = await this.searchRepository.searchLargeAssets(dto.size || 250, {\n      ...dto,\n      visibility: dto.visibility ?? (auth.session?.hasElevatedPermission ? undefined : 'not-locked'),\n      userIds,\n    });\n    return items.map((item) => mapAsset(item, { auth }));\n  }\n\n  async searchSmart(auth: AuthDto, dto: SmartSearchDto): Promise<SearchResponseDto> {\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    let embedding;\n    if (dto.query) {\n      const key = machineLearning.clip.modelName + dto.query + dto.language;\n      embedding = this.embeddingCache.get(key);\n      if (!embedding) {\n        embedding = await this.machineLearningRepository.encodeText(dto.query, {\n          modelName: machineLearning.clip.modelName,\n          language: dto.language,\n        });\n        this.embeddingCache.set(key, embedding);\n      }\n    } else if (dto.queryAssetId) {\n      await this.requireAccess({ auth, permission: Permission.AssetRead, ids: [dto.queryAssetId] });\n      const getEmbeddingResponse = await this.searchRepository.getEmbedding(dto.queryAssetId);\n      const assetEmbedding = getEmbeddingResponse?.embedding;","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/immich-app/immich/blob/199723261c6ffa897fec8ccdaea6359e39c37cc3/server/src/services/search.service.ts#L132-L168","documentation":"Thrown by SearchService.searchSmart when isSmartSearchEnabled(machineLearning) is false, i.e. machineLearning.enabled is false OR machineLearning.clip.enabled is false. CLIP text/image embeddings are required for smart search, so the request cannot be served. BadRequestException -> HTTP 400.","triggerScenarios":"POST /search/smart (or GET /search/smart) when Machine Learning is disabled in Administration > Settings, or when the CLIP variant is disabled.","commonSituations":"Fresh install without enabling ML; ML server URL misconfigured so the admin toggled ML off; CLIP disabled to save resources; deployment without the immich-machine-learning container.","solutions":["Enable Machine Learning in Administration > Machine Learning Settings.","Ensure the CLIP sub-setting is enabled and a model is selected.","Confirm the immich-machine-learning container is running and reachable, then re-enable.","Call GET /server/features to check `smartSearch: true` before exposing the UI."],"exampleFix":"// before\nif (!isSmartSearchEnabled(machineLearning)) {\n  throw new BadRequestException('Smart search is not enabled');\n}\n\n// client-side guard\nconst features = await api.get('/server/features');\nif (!features.smartSearch) {\n  showToast('Smart search is disabled. Enable Machine Learning in Administration.');\n  return;\n}","handlingStrategy":"validation","validationCode":"// Check server features before offering smart search.\nconst features = await serverService.getFeatures();\nif (!features.smartSearch) {\n  // hide the smart-search UI; do not call /search/smart\n  return;\n}\nawait searchService.searchSmart(auth, dto);","typeGuard":"const isSmartSearchAvailable = (f: ServerFeaturesDto): boolean => !!f.smartSearch;","tryCatchPattern":"try {\n  await searchService.searchSmart(auth, dto);\n} catch (e) {\n  if (e instanceof BadRequestException && /Smart search is not enabled/i.test(e.message)) {\n    // prompt admin to enable Machine Learning and abort\n  }\n  throw e;\n}","preventionTips":["Gate the smart-search UI on GET /server/features.smartSearch.","Verify the immich-machine-learning container is running before enabling CLIP.","After enabling ML, confirm the CLIP sub-toggle is on."],"tags":["search","machine-learning","clip","smart-search","configuration","nestjs"],"backgroundTag":null,"analyzedSha":"199723261c6ffa897fec8ccdaea6359e39c37cc3","analyzedAt":"2026-08-12T04:54:27.085Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}