{"record":{"id":"b65bc749be942a5a","repo":"Tencent/WeKnora","slug":"parser-engine-q-is-unavailable-s","errorCode":null,"errorMessage":"parser engine %q is unavailable: %s","messagePattern":"parser engine %q is unavailable: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/infrastructure/docparser/engine_registry.go","lineNumber":150,"sourceCode":"\t\t\tAvailable:         available,\n\t\t\tUnavailableReason: reason,\n\t\t})\n\t}\n\n\tfor _, re := range remoteEngines {\n\t\tif seen[re.Name] {\n\t\t\tcontinue\n\t\t}\n\t\tresult = append(result, re)\n\t}\n\n\treturn result\n}\n\n// errEngineUnavailable reports an engine that is registered but cannot run for\n// this tenant or this build.\nfunc errEngineUnavailable(engine, reason string) error {\n\treturn fmt.Errorf(\"parser engine %q is unavailable: %s\", engine, reason)\n}\n","sourceCodeStart":132,"sourceCodeEnd":152,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/infrastructure/docparser/engine_registry.go#L132-L152","documentation":"errEngineUnavailable reports that a document parser engine is registered in the registry but cannot run in the current context — e.g. it is disabled for this tenant, lacks required credentials, or was compiled out of this build. NewReader surfaces this when the requested engine can't actually be used, with the concrete reason in the message.","triggerScenarios":"Calling NewReader (which resolves an engine by name) for an engine whose availability check fails: tenant not allow-listed, API key missing, engine disabled by config, or binary built without that engine's dependencies.","commonSituations":"Config requesting an engine (e.g. anydoc/external OCR) whose cloud credentials aren't set in the environment; engine gated behind a license or feature flag off for the tenant; docker image built without CGO/native deps for that engine; typo'd engine name matching a registered-but-disabled engine.","solutions":["Read the reason suffix in the error and fix that specific cause (missing credential, disabled flag, etc.).","Set the required env/config for the engine (API keys, endpoint) or enable it for the tenant.","Fall back to another registered engine available for the tenant via the registry's selection logic.","If the engine requires build tags/native deps, rebuild/deploy an image that includes it, or remove it from the requested config."],"exampleFix":"// before\nengine: \"anydoc\" // tenant lacks anydoc credentials\n// after\n# set credentials or pick an available engine\nANYDOC_API_KEY=... ; engine: \"builtin\" // fallback until enabled","handlingStrategy":"fallback","validationCode":"if !registry.IsAvailable(requestedEngine, tenantID) {\n    requestedEngine = registry.DefaultEngine(tenantID)\n}","typeGuard":"func engineAvailable(reg *EngineRegistry, name, tenant string) bool {\n    return reg != nil && reg.IsAvailable(name, tenant)\n}","tryCatchPattern":"reader, err := NewReader(ctx, cfg)\nif err != nil && strings.Contains(err.Error(), \"is unavailable\") {\n    reader, err = NewReader(ctx, cfg.WithEngine(DefaultEngine)) // fallback\n}","preventionTips":["Check engine availability per tenant before selecting it in config.","Set all required engine credentials/env vars at deploy time.","Pin engine names in config to ones enabled for the tenant; avoid typos.","Build/deploy images that include every parser engine you request (incl. native deps).","Implement automatic fallback to the default engine on this error."],"tags":["docparser","engine-registry","configuration","unavailable"],"backgroundTag":"parser-engine-unavailable","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}