Attachment data (url, file_path) leaks into tts.speak payload on multi-target notify.send calls
What version of Universal Notifier are you using?
dev_improvment branch, manifest reports 0.8.0 (issue reproduced and confirmed still present after updating to the v0.8.1 tag — see https://github.com/jumping2000/universal_notifier/issues/25#issuecomment-4723996199 on the now-closed duplicate)
What version of Home Assistant are you using?
Core 2026.5.4
The problem
When a single universal_notifier.send call fans out to both a text/photo channel and a voice (tts.speak) channel, and the call carries attachment-style keys (url, file_path, etc. — typical for a data: {type: photo, url: ...} payload), those keys leak into the tts.speak payload and break the voice notification with:
UniNotifier: Errore nel worker vocale: extra keys not allowed @ data['file_path']
UniNotifier: Errore nel worker vocale: extra keys not allowed @ data['url']
Root cause in __init__.py, Sezione I ("Merge Dati Accessori"):
if all_additional_data:
if srv_domain == "notify":
if "data" not in service_payload: service_payload["data"] = {}
service_payload["data"].update(all_additional_data)
else:
service_payload.update(all_additional_data)
Only volume, type and parse_mode are stripped beforehand (a few lines above). The generic else branch still applies to srv_domain == "tts", so any extra attachment data gets merged straight into the tts.speak payload, which has a fixed schema and rejects unknown keys. The failure is swallowed generically by voice_queue_worker's except Exception, so the voice channel silently fails for that target.
Proposed fix — exclude tts from the generic merge, since tts.speak never accepts attachment-style keys:
if all_additional_data:
if srv_domain == "notify":
if "data" not in service_payload: service_payload["data"] = {}
service_payload["data"].update(all_additional_data)
elif srv_domain != "tts":
service_payload.update(all_additional_data)
# tts.speak doesn't accept extra keys like url/file_path/caption
Applied locally on top of v0.8.1 and confirmed it resolves the worker error.
What is your channels configuration for Universal Notifier?
"Marco": {
"alt_services": { "photo": { "service": "telegram_bot.send_photo" } },
"is_voice": false,
"service": "notify.telegrammarco",
"target": ""
},
"google_jarvis": {
"alt_services": {},
"default_media_player": "media_player.jarvis",
"is_voice": true,
"service": "tts.speak",
"target": "tts.piper"
}
What actions did you take in the developer tools?
action: universal_notifier.send
data:
targets:
- Marco
- google_jarvis
message: "Test multi-target"
data:
type: photo
url: "https://example.com/test.jpg"
This single call fans out to both the Marco text/photo channel and the google_jarvis voice channel; the url attachment key meant for Marco's photo leaks into google_jarvis's tts.speak payload via the Sezione I merge described above.
Anything in the logs? Paste it here!
UniNotifier: Errore nel worker vocale: extra keys not allowed @ data['file_path']
UniNotifier: Errore nel worker vocale: extra keys not allowed @ data['url']
(Originally reproduced via recurring automations that send the same notification to both a Telegram/photo channel and a voice channel in one call; reconstructed here as a minimal manual repro per the template, since the original automation's live log lines have since rotated out.)
Re-filing per the issue template — this was originally reported in #25, which was closed for not following the template. Confirmed still present after testing against the v0.8.1 tag.
@jokerigno I think is related to the use of "notify.telegrammarco", try configuring telegram_bot.send_message
Follow-up dopo aver risolto #26: anche qui il root cause è una mia configurazione, non un bug di UN.
Il mio package natural_events.yaml è una versione molto modificata di caiosweet/Package-Natural-Events (il package originale non usa affatto universal_notifier, ha un proprio script.notify_hub con chiamate dirette a notify.* — l'integrazione con UN l'ho aggiunta io durante la migrazione). Nelle mie automazioni passavo type/url/file_path dentro il data globale insieme a targets: [Marco, google_jarvis] (Telegram + voce nello stesso universal_notifier.send). Per design, come documentato nel README ("data: Generic extra data applied to ALL underlying services"), questo viene mergiato anche nel payload tts.speak di google_jarvis, da cui l'errore.
Ho spostato type/url/file_path in target_data: {Marco: {...}} in tutte le automazioni che mixano un target Telegram con un target voce nella stessa chiamata — così l'attachment data resta scoped al solo target Marco, nessun leak verso tts.speak. Confermo che con questo fix l'errore non si presenta più, senza bisogno di patch sul codice.
Resta valida la patch proposta sopra (escludere tts dal merge generico in Sezione I) come miglioramento defensive/UX per evitare che un uso scorretto di data da parte di altri utenti rompa silenziosamente un canale voce — ma non è strettamente necessaria per il mio caso specifico.
SOLVED