Skip to content

Speakr is a personal, self-hosted web application designed for transcribing audio recordings

Python

Capture upstream response body in asr_endpoint errors so technical details panel shows the real failure

Murtaza Nasir60da410b87fc
diff --git a/src/services/transcription/connectors/asr_endpoint.py b/src/services/transcription/connectors/asr_endpoint.py
index b9991f30..f51cfee9 100644
--- a/src/services/transcription/connectors/asr_endpoint.py
+++ b/src/services/transcription/connectors/asr_endpoint.py
@@ -215,9 +215,26 @@ class ASREndpointConnector(BaseTranscriptionConnector):
return self._parse_response(data)
except httpx.HTTPStatusError as e:
- logger.error(f"ASR request failed with status {e.response.status_code}")
+ # Capture the upstream response body so the actual error message
+ # (e.g. faster-whisper's "Invalid model size 'whisper-tiny'") is
+ # preserved instead of being collapsed to just a status code.
+ try:
+ body = e.response.text
+ except Exception:
+ body = ''
+ body_excerpt = body.strip()
+ if len(body_excerpt) > 800:
+ body_excerpt = body_excerpt[:800] + '...'
+ logger.error(
+ f"ASR request failed with status {e.response.status_code}: {body_excerpt}"
+ )
+ detail = (
+ f"ASR request failed with status {e.response.status_code}: {body_excerpt}"
+ if body_excerpt
+ else f"ASR request failed with status {e.response.status_code}"
+ )
raise ProviderError(
- f"ASR request failed with status {e.response.status_code}",
+ detail,
provider=self.PROVIDER_NAME,
status_code=e.response.status_code
) from e
diff --git a/src/utils/error_formatting.py b/src/utils/error_formatting.py
index 0bbcab69..591f8ce3 100644
--- a/src/utils/error_formatting.py
+++ b/src/utils/error_formatting.py
@@ -299,8 +299,10 @@ def format_error_for_storage(error_text: str) -> str:
'k': formatted['is_known'],
}
- # Only include technical details if it adds value
- if formatted['technical'] and formatted['technical'] != formatted['message']:
+ # Always include the raw technical detail when present, so the UI's
+ # "Technical details" panel has something to show even for unknown errors
+ # where the user-facing message is the same as the raw text.
+ if formatted['technical']:
error_data['d'] = formatted['technical'][:500] # Limit technical detail length
try: