Tencent/WeKnora · error
transcribe audio: %w
Error message
transcribe audio: %w
What it means
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).
Source
Thrown at internal/application/service/temporary_document.go:381
if options.ParserEngine == "" || options.ParserEngine == "auto" {
if tenant, ok := ctx.Value(types.TenantInfoContextKey).(*types.Tenant); ok && tenant != nil {
options.ParserEngine = tenant.ParserEngineConfig.ResolveChatParserEngine(ext)
}
}
if _, ok := temporaryTextExtensions[ext]; ok && (options.ParserEngine == "" || options.ParserEngine == "auto") {
return string(data), nil, map[string]string{"parser": "plain_text"}, nil
}
if docparser.IsAudioFormat(ext) {
if options.ASRModelID == "" {
return "", nil, nil, fmt.Errorf("audio transcription model is not configured")
}
asrModel, err := s.modelService.GetASRModel(ctx, options.ASRModelID)
if err != nil {
return "", nil, nil, fmt.Errorf("load ASR model: %w", err)
}
result, err := asrModel.Transcribe(ctx, data, document.FileName)
if err != nil {
return "", nil, nil, fmt.Errorf("transcribe audio: %w", err)
}
return result.Text, nil, map[string]string{"parser": "asr"}, nil
}
parserEngine := strings.TrimSpace(options.ParserEngine)
if parserEngine == "auto" {
parserEngine = ""
}
request := &types.ReadRequest{
FileContent: data, FileName: document.FileName, FileType: strings.TrimPrefix(ext, "."),
ParserEngine: parserEngine,
}
if tenant, ok := ctx.Value(types.TenantInfoContextKey).(*types.Tenant); ok && tenant != nil && tenant.ParserEngineConfig != nil {
request.ParserEngineOverrides = tenant.ParserEngineConfig.ToOverridesMap()
}
deps := docparser.ReaderDeps{Overrides: request.ParserEngineOverrides, Remote: s.documentReader}
if s.tenantService != nil {
deps.WeKnoraCloudCredentials = s.tenantService.GetWeKnoraCloudCredentialsView on GitHub (pinned to 988cbb0330)
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
Defensive patterns
Strategy: retry
Validate before calling
// pre-check: file extension supported by ASR model
if !supportedByASR(model, ext) { return errors.New("unsupported audio format for this ASR model") } Try / catch
if err != nil {
if strings.HasPrefix(err.Error(), "transcribe audio:") && isTransient(err) {
// retry with backoff
}
} Prevention
- Validate audio codec/format before upload
- Monitor ASR provider quota and credentials
- Retry transient failures with backoff
When it happens
Trigger: 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.
Common situations: 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.
Related errors
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/9bedfe45581a09a0.
Report an issue: GitHub.