Tencent/WeKnora · error

load ASR model: %w

Error message

load ASR model: %w

What it means

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.

Source

Thrown at internal/application/service/temporary_document.go:377

	}
	ext := document.FileType
	var options types.TemporaryDocumentCreateOptions
	_ = json.Unmarshal(document.ProcessingOptions, &options)
	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()

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Verify the ASRModelID exists and is accessible for the current tenant
  2. Refresh the model list in the client and reselect a valid transcription model
  3. Check model service / registry health and database connectivity
  4. Inspect the wrapped cause (%w) for the root error
Defensive patterns

Strategy: try-catch

Try / catch

if err != nil {
    if strings.HasPrefix(err.Error(), "load ASR model:") {
        // refresh model list, reselect valid model, log %w cause via errors.Unwrap
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: Stale ASR model ID cached in the UI after the model was removed; copy-pasted model ID from another tenant; database/model-registry outage.

Related errors


AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02). Data as JSON: /api/errors/45878c72d7f57f81. Report an issue: GitHub.