{"record":{"id":"9bedfe45581a09a0","repo":"Tencent/WeKnora","slug":"transcribe-audio-w","errorCode":null,"errorMessage":"transcribe audio: %w","messagePattern":"transcribe audio: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/temporary_document.go","lineNumber":381,"sourceCode":"\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()\n\t}\n\tdeps := docparser.ReaderDeps{Overrides: request.ParserEngineOverrides, Remote: s.documentReader}\n\tif s.tenantService != nil {\n\t\tdeps.WeKnoraCloudCredentials = s.tenantService.GetWeKnoraCloudCredentials","sourceCodeStart":363,"sourceCodeEnd":399,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/temporary_document.go#L363-L399","documentation":"Wraps a failure from asrModel.Transcribe when the loaded ASR model fails to transcribe the audio bytes. The model was found and loaded, but the transcription call itself failed (upstream provider error, unsupported codec, corrupted file, timeout, quota).","triggerScenarios":"Process on an audio file where asrModel.Transcribe(ctx, data, document.FileName) returns an error — e.g. unsupported audio codec, file too large, ASR provider returns 4xx/5xx, or network failure to the ASR backend.","commonSituations":"Unsupported sample rate/codec sent to the ASR provider; ASR API key invalid or quota exhausted; audio file truncated/corrupt during upload; transient provider outage.","solutions":["Inspect the wrapped error to identify the ASR provider failure","Validate the audio file is a supported, uncorrupted format for the chosen ASR model","Check ASR provider credentials, quota, and network reachability","Retry the upload/transcription for transient provider errors"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// pre-check: file extension supported by ASR model\nif !supportedByASR(model, ext) { return errors.New(\"unsupported audio format for this ASR model\") }","typeGuard":null,"tryCatchPattern":"if err != nil {\n    if strings.HasPrefix(err.Error(), \"transcribe audio:\") && isTransient(err) {\n        // retry with backoff\n    }\n}","preventionTips":["Validate audio codec/format before upload","Monitor ASR provider quota and credentials","Retry transient failures with backoff"],"tags":["audio","asr","transcription-failure","upstream"],"backgroundTag":"upstream-api-error","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}