{"record":{"id":"c4e396f36dc97a11","repo":"AlistGo/alist","slug":"searchnotavailable","errorCode":"SearchNotAvailable","errorMessage":"search not available","messagePattern":"search not available","errorType":"exception","errorClass":"SearchNotAvailable","httpStatus":null,"severity":"warning","filePath":"internal/errs/search.go","lineNumber":6,"sourceCode":"package errs\n\nimport \"fmt\"\n\nvar (\n\tSearchNotAvailable  = fmt.Errorf(\"search not available\")\n\tBuildIndexIsRunning = fmt.Errorf(\"build index is running, please try later\")\n)\n","sourceCodeStart":1,"sourceCodeEnd":9,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/internal/errs/search.go#L1-L9","documentation":"A sentinel error from the internal/errs package meaning the search feature is not usable in the current state — typically because no search driver/index backend is configured or available. It is compared by identity (errs.SearchNotAvailable), not by string matching. Sibling sentinel BuildIndexIsRunning indicates the index is mid-rebuild and the caller should retry later.","triggerScenarios":"Invoking a search API/handler while the configured search driver is nil, disabled, or failed to initialize; calling search before the index has ever been built.","commonSituations":"Fresh install with no search driver selected in settings; search driver set to 'none' or left empty; database-based search where the index table/driver was never initialized; disabling the search feature and then hitting a search route.","solutions":["Set a valid search driver (e.g. database or bleve) in the site settings and restart/reinitialize.","If a build is in progress, wait and retry — check for errs.BuildIndexIsRunning separately.","Verify the search-related settings persisted correctly (no empty driver string).","In the UI/layer above, surface this as 'search disabled' rather than a generic 500."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"if err == errs.SearchNotAvailable { /* show 'search disabled' UI */ }\nif err == errs.BuildIndexIsRunning { /* retry later */ }","tryCatchPattern":"results, err := search.Search(ctx, req)\nif err != nil {\n    switch err {\n    case errs.SearchNotAvailable:\n        return fmt.Errorf(\"search is disabled: %w\", err)\n    case errs.BuildIndexIsRunning:\n        time.Sleep(retryDelay)\n        // retry once\n    }\n}","preventionTips":["Check whether a search driver is configured before exposing search UI.","Distinguish the two sentinels (not available vs. building) with identity comparison, never string matching.","After changing search settings, trigger an index build and wait for it to finish before serving queries."],"tags":["search","configuration","sentinel-error","go"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}