{"record":{"id":"7d0217adb23ebab9","repo":"usememos/memos","slug":"internal","errorCode":"Internal","errorMessage":"transcription response did not include text","messagePattern":"transcription response did not include text","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/router/api/v1/ai_service.go","lineNumber":177,"sourceCode":"\tm, err := audiollmgemini.New(provider, audiollm.ApplyOptions(nil))\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"failed to create audio LLM\")\n\t}\n\tresp, err := m.GenerateFromAudio(ctx, audiollm.Request{\n\t\tAudio:        bytes.NewReader(content),\n\t\tSize:         int64(len(content)),\n\t\tContentType:  contentType,\n\t\tModel:        model,\n\t\tInstructions: buildTranscriptionInstructions(persisted.GetPrompt(), persisted.GetLanguage()),\n\t})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif resp.FinishReason != audiollm.FinishStop {\n\t\treturn \"\", errors.Errorf(\"transcription incomplete (finish reason: %s)\", resp.FinishReason)\n\t}\n\tif strings.TrimSpace(resp.Text) == \"\" {\n\t\treturn \"\", errors.New(\"transcription response did not include text\")\n\t}\n\treturn resp.Text, nil\n}\n\nfunc buildTranscriptionInstructions(prompt, language string) string {\n\tparts := []string{\n\t\t\"Transcribe the audio accurately. Return only the transcript text. \" +\n\t\t\t\"Do not summarize, explain, or add content that is not spoken.\",\n\t}\n\tif language = strings.TrimSpace(language); language != \"\" {\n\t\tparts = append(parts, \"The input language is \"+language+\".\")\n\t}\n\tif prompt = strings.TrimSpace(prompt); prompt != \"\" {\n\t\tparts = append(parts, \"Context and spelling hints:\\n\"+prompt)\n\t}\n\treturn strings.Join(parts, \"\\n\\n\")\n}\n","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/usememos/memos/blob/14d757ce1fb31c78590f374bc042f8dbedbc20d7/server/router/api/v1/ai_service.go#L159-L195","documentation":"After the audio LLM returned a transcription with FinishStop, the response's Text field was empty/whitespace, so the memo transcription pipeline treats it as an unusable result (Internal error). The model completed without producing any transcript content.","triggerScenarios":"Transcribing a silent or near-silent audio file, a file whose content is all filtered noise, or a model/provider misconfiguration that returns an empty completion; also possible when a provider returns content in a non-standard field Memos does not read.","commonSituations":"Uploading music/noise files expecting transcription; very short clips; wrong model name configured for the AI provider so responses lack text; provider API version changes altering the response shape.","solutions":["Verify the audio actually contains speech (play it back; check duration/waveform)","Confirm the AI provider and model settings in Memos are correct and the model supports audio transcription","Retry once — occasional empty completions happen; if persistent, test the same file against the provider directly","File an issue if the provider returns text in a field Memos does not map"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Before transcribing, sanity-check the audio has speech-sized content\nfunc likelyHasSpeech(path string) bool {\n  info, err := os.Stat(path)\n  if err != nil || info.Size() < 1024 { return false } // <1s of compressed audio\n  return true\n}","typeGuard":null,"tryCatchPattern":"// Retry once, then surface a user-actionable error\ntext, err := transcribe(ctx, content)\nif err != nil {\n  if strings.Contains(err.Error(), \"did not include text\") {\n    text, err = transcribe(ctx, content) // one retry for flaky completions\n    if err != nil { return status.Errorf(codes.InvalidArgument, \"no speech detected in audio\") }\n  } else { return err }\n}","preventionTips":["Pre-validate audio duration/size client-side before requesting transcription","Keep AI provider/model settings verified with a canary request at config time","Treat empty transcripts as user-content issues first (silent audio), config issues second"],"tags":["ai","transcription","audio"],"backgroundTag":null,"analyzedSha":"14d757ce1fb31c78590f374bc042f8dbedbc20d7","analyzedAt":"2026-08-15T09:27:36.538Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}