{"record":{"id":"3395b2273e49c92f","repo":"siyuan-note/siyuan","slug":"tesseract-ocr-is-not-installed-or-configured-plea","errorCode":null,"errorMessage":"Tesseract OCR is not installed or configured, please refer to the User Guide - Assets section for configuration","messagePattern":"Tesseract OCR is not installed or configured, please refer to the User Guide - Assets section for configuration","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"kernel/util/ocr.go","lineNumber":162,"sourceCode":"\tassetsTextsLock.Lock()\n\toldText, ok := assetsTexts[asset]\n\tassetsTexts[asset] = text\n\tassetsTextsLock.Unlock()\n\tif !ok || oldText != text {\n\t\tassetsTextsChanged.Store(true)\n\t}\n}\n\nfunc ExistsAssetText(asset string) (ret bool) {\n\tassetsTextsLock.Lock()\n\t_, ret = assetsTexts[asset]\n\tassetsTextsLock.Unlock()\n\treturn\n}\n\nfunc OcrAsset(asset string) (ret []map[string]any, err error) {\n\tif !TesseractEnabled {\n\t\terr = errors.New(Langs[Lang][266])\n\t\treturn\n\t}\n\n\tassetsPath := GetDataAssetsAbsPath()\n\tassetAbsPath := strings.TrimPrefix(asset, \"assets\")\n\tassetAbsPath = filepath.Join(assetsPath, assetAbsPath)\n\tret = Tesseract(assetAbsPath)\n\tassetsTextsLock.Lock()\n\tocrText := GetOcrJsonText(ret)\n\tassetsTexts[asset] = ocrText\n\tassetsTextsLock.Unlock()\n\tif \"\" != ocrText {\n\t\tassetsTextsChanged.Store(true)\n\t}\n\treturn\n}\n\nfunc GetAssetText(asset string) (ret string) {","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/util/ocr.go#L144-L180","documentation":"OcrAsset performs OCR on an asset file using the external Tesseract binary. SiYuan gates this behind the TesseractEnabled flag (populated from configuration/environment detection); when it is false the call fails immediately with this localized message rather than attempting to spawn a missing binary.","triggerScenarios":"Calling OcrAsset (directly or via the ocr pipeline used by asset full-text indexing / search) while Tesseract OCR is not installed, or its path is not configured in Settings - Assets so TesseractEnabled stays false.","commonSituations":"Fresh SiYuan installs without Tesseract; Docker images lacking the tesseract-ocr package; users who installed Tesseract but did not set its path in the settings so detection failed.","solutions":["Install Tesseract OCR (apt install tesseract-ocr / brew install tesseract / Windows installer)","Configure the Tesseract path in Settings - Assets (配置路径) so SiYuan detects it and sets TesseractEnabled","Restart the kernel after installing/configuring so detection re-runs","In Docker, use an image or Dockerfile layer that includes tesseract-ocr and required language packs"],"exampleFix":"// before\n// TesseractEnabled == false -> OcrAsset returns i18n error\n// after\n# install and register the binary\napt-get install -y tesseract-ocr\n# set the path in Settings - Assets, restart kernel","handlingStrategy":"fallback","validationCode":"// Go\nif !util.TesseractEnabled {\n    // skip OCR-dependent indexing or prompt the user to configure Tesseract\n}","typeGuard":null,"tryCatchPattern":"if _, err := util.OcrAsset(asset); err != nil {\n    if !util.TesseractEnabled {\n        log.Println(\"OCR unavailable: install/configure Tesseract\")\n        return nil // degrade gracefully: index without OCR text\n    }\n    return err\n}","preventionTips":["Install Tesseract and register its path in Settings - Assets on every machine","Include tesseract-ocr in Docker images and deployment scripts","Re-check detection after OS upgrades that may move the binary","Index assets with OCR as optional, not required, functionality"],"tags":["go","ocr","tesseract","missing-dependency"],"backgroundTag":"missing-dependency","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}