{"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/251596fc0de2f9528c00c224252fd073a99973f4/kernel/util/ocr.go#L144-L180","documentation":"OcrAsset short-circuits with this localized error when the package-level TesseractEnabled flag is false. The flag is set during boot only if the tesseract binary (TesseractBin) is found on PATH and OCR is enabled in config. Calling OCR on any asset before that is a no-op that returns this error.","triggerScenarios":"Invoking OcrAsset (index-time OCR, asset-text search) on a deployment where Tesseract is not installed, not on PATH, disabled in settings, or where the binary name differs from TesseractBin.","commonSituations":"Fresh install without OCR deps; portable build on a machine without tesseract; OCR toggled off in settings; Docker image without the tesseract package and language data.","solutions":["Install Tesseract (apt-get install tesseract-ocr / brew install tesseract / Windows installer) plus the needed language packs.","Ensure 'tesseract' is on PATH, or set TesseractBin to its absolute path.","Enable OCR in settings and restart the kernel so TesseractEnabled flips on.","If OCR is optional, check TesseractEnabled and degrade gracefully (skip asset indexing)."],"exampleFix":"// before\nres, err := util.OcrAsset(asset)\n\n// after\nif !util.TesseractEnabled {\n    logging.LogInfof(\"OCR disabled, skipping %s\", asset)\n    return nil\n}\nres, err := util.OcrAsset(asset)","handlingStrategy":"type-guard","validationCode":"if !util.TesseractEnabled {\n    return nil // OCR unavailable, skip\n}\nres, err := util.OcrAsset(asset)","typeGuard":"func OcrAvailable() bool { return util.TesseractEnabled }","tryCatchPattern":null,"preventionTips":["Check TesseractEnabled before calling OcrAsset","Bundle tesseract in container images if OCR is required","Document the language-data dependency alongside the binary"],"tags":["ocr","tesseract","assets","go","config"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}