{"record":{"id":"45878c72d7f57f81","repo":"Tencent/WeKnora","slug":"load-asr-model-w","errorCode":null,"errorMessage":"load ASR model: %w","messagePattern":"load ASR model: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/temporary_document.go","lineNumber":377,"sourceCode":"\t}\n\text := document.FileType\n\tvar options types.TemporaryDocumentCreateOptions\n\t_ = json.Unmarshal(document.ProcessingOptions, &options)\n\tif options.ParserEngine == \"\" || options.ParserEngine == \"auto\" {\n\t\tif tenant, ok := ctx.Value(types.TenantInfoContextKey).(*types.Tenant); ok && tenant != nil {\n\t\t\toptions.ParserEngine = tenant.ParserEngineConfig.ResolveChatParserEngine(ext)\n\t\t}\n\t}\n\tif _, ok := temporaryTextExtensions[ext]; ok && (options.ParserEngine == \"\" || options.ParserEngine == \"auto\") {\n\t\treturn string(data), nil, map[string]string{\"parser\": \"plain_text\"}, nil\n\t}\n\tif docparser.IsAudioFormat(ext) {\n\t\tif options.ASRModelID == \"\" {\n\t\t\treturn \"\", nil, nil, fmt.Errorf(\"audio transcription model is not configured\")\n\t\t}\n\t\tasrModel, err := s.modelService.GetASRModel(ctx, options.ASRModelID)\n\t\tif err != nil {\n\t\t\treturn \"\", nil, nil, fmt.Errorf(\"load ASR model: %w\", err)\n\t\t}\n\t\tresult, err := asrModel.Transcribe(ctx, data, document.FileName)\n\t\tif err != nil {\n\t\t\treturn \"\", nil, nil, fmt.Errorf(\"transcribe audio: %w\", err)\n\t\t}\n\t\treturn result.Text, nil, map[string]string{\"parser\": \"asr\"}, nil\n\t}\n\n\tparserEngine := strings.TrimSpace(options.ParserEngine)\n\tif parserEngine == \"auto\" {\n\t\tparserEngine = \"\"\n\t}\n\trequest := &types.ReadRequest{\n\t\tFileContent: data, FileName: document.FileName, FileType: strings.TrimPrefix(ext, \".\"),\n\t\tParserEngine: parserEngine,\n\t}\n\tif tenant, ok := ctx.Value(types.TenantInfoContextKey).(*types.Tenant); ok && tenant != nil && tenant.ParserEngineConfig != nil {\n\t\trequest.ParserEngineOverrides = tenant.ParserEngineConfig.ToOverridesMap()","sourceCodeStart":359,"sourceCodeEnd":395,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/temporary_document.go#L359-L395","documentation":"Wraps a failure from s.modelService.GetASRModel while loading the ASR model requested by options.ASRModelID. The ID was non-empty but the model could not be retrieved (not found, deleted, wrong tenant, backend store error). The underlying cause is preserved via %w.","triggerScenarios":"Process on an audio file where options.ASRModelID references a model that does not exist, was deleted, belongs to another tenant, or the model service itself errors.","commonSituations":"Stale ASR model ID cached in the UI after the model was removed; copy-pasted model ID from another tenant; database/model-registry outage.","solutions":["Verify the ASRModelID exists and is accessible for the current tenant","Refresh the model list in the client and reselect a valid transcription model","Check model service / registry health and database connectivity","Inspect the wrapped cause (%w) for the root error"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil {\n    if strings.HasPrefix(err.Error(), \"load ASR model:\") {\n        // refresh model list, reselect valid model, log %w cause via errors.Unwrap\n    }\n}","preventionTips":["Fetch ASR model IDs from the model list API rather than hardcoding","Handle model-deleted events in the client","Log errors.Unwrap(err) for root cause"],"tags":["audio","asr","model-not-found","wrap"],"backgroundTag":"model-not-found","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}