/
/
/
# What does this implement/fix? Home Assistant hands out a TTS proxy URL before it renders the audio, so `tts_get_url` always succeeds. When the render then fails (for example a Gemini TTS quota of `429 RESOURCE_EXHAUSTED`), HA logs the reason itself and answers the fetch with a bare 500 and an empty body. AI Radio treated that as "duration unknown", played the dead URL anyway, and left the user with a warning per clip plus an ffmpeg `HTTP error 500`. Nothing pointed at the real cause. The duration probe is the first fetch of the audio, so it is also where a failed render shows up. It now tells a server error apart from a clip it simply cannot measure, and fails the clip with a message the user can act on. - Move the duration probe into `_mint_clip_media`, so a failed render runs through the path that already logs the clip and records the error on the session. - Fail the clip on a server error with: `Error during TTS generation. Does your TTS provider have enough credit? Check the logs of your TTS provider for the reason.` - Keep every other probe failure best-effort. A clip that cannot be measured still plays without a duration. The message is a hint, not the cause, because HA sends no body. A follow-up in HA core could put the error in the 500 body and make this exact. **Related issue (if applicable):** - n/a ## Types of changes <!-- Tick exactly one box. CI (.github/workflows/pr-labels.yaml) derives the label from the ticked box and applies it automatically; the release-notes generator uses that same label to slot this change into the next release notes. --> - [x] Bugfix (non-breaking change which fixes an issue) — `bugfix` - [ ] New feature (non-breaking change which adds functionality) — `new-feature` - [ ] Enhancement to an existing feature — `enhancement` - [ ] New music/player/metadata/plugin provider — `new-provider` - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) — `breaking-change` - [ ] Refactor (no behaviour change) — `refactor` - [ ] Documentation only — `documentation` - [ ] Maintenance / chore — `maintenance` - [ ] CI / workflow change — `ci` - [ ] Dependencies bump — `dependencies` ## Checklist - [x] The code change is tested and works locally. - [x] `pre-commit run --all-files` passes. - [x] `pytest` passes, and tests have been added/updated under `tests/` where applicable. - [ ] For changes to shared models, the companion PR in `music-assistant/models` is linked. - [ ] For changes affecting the UI, the companion PR in `music-assistant/frontend` is linked. - [x] I have read and complied with the project's [AI Policy](https://github.com/music-assistant/.github/blob/main/AI_POLICY.md) for any AI-assisted contributions. - [ ] I have [raised a PR against the documentation repository](https://github.com/music-assistant/music-assistant.io/blob/main/CONTRIBUTING.md) targeting the main or beta branch as appropriate.