home-assistant/core · error · AlexaInvalidValueError
INVALID_VALUE
INVALID_VALUE
Error message
failed to map input {media_input} to a media source on {entity.entity_id} What it means
When Alexa selects an input (e.g. 'HDMI 1'), the handler tries to map the spoken name to one of the media_player entity's source_list entries, comparing case-formatted names and also tolerating a trailing '1' (e.g. 'HDMI1' vs 'HDMI'). If no source matches, it raises AlexaInvalidValueError, which Alexa reports back as INVALID_VALUE.
Source
Thrown at homeassistant/components/alexa/handlers.py:625
source_list = entity.attributes.get(media_player.ATTR_INPUT_SOURCE_LIST) or []
for source in source_list:
formatted_source = (
source.lower().replace("-", "").replace("_", "").replace(" ", "")
)
media_input = media_input.lower().replace(" ", "")
if (
formatted_source in Inputs.VALID_SOURCE_NAME_MAP
and formatted_source == media_input
) or (
media_input.endswith("1") and formatted_source == media_input.rstrip("1")
):
media_input = source
break
else:
msg = (
f"failed to map input {media_input} to a media source on {entity.entity_id}"
)
raise AlexaInvalidValueError(msg)
data: dict[str, Any] = {
ATTR_ENTITY_ID: entity.entity_id,
media_player.ATTR_INPUT_SOURCE: media_input,
}
await hass.services.async_call(
entity.domain,
media_player.SERVICE_SELECT_SOURCE,
data,
blocking=False,
context=context,
)
return directive.response()
@HANDLERS.register(("Alexa.Speaker", "AdjustVolume"))View on GitHub (pinned to 58a3fdb3ea)
Solutions
- Rename the media_player's sources so they match Alexa's spoken input names (e.g. 'HDMI 1', 'AV 1'), via the integration's source-list configuration or entity customization.
- Expose inputs through an Alexa ModeController with modes whose friendly names equal the source_list entries.
- Test with developer tools: check the entity's source_list attribute, then call media_player.select_source with the exact string Alexa sends.
Example fix
# before: source_list = ['hdmi_1', 'game'] # Alexa says 'HDMI 1' -> AlexaInvalidValueError # after: customize the entity so source_list entries match spoken names media_player: - platform: ... # or rename on the device/integration to ['HDMI 1', 'Game']
Defensive patterns
Strategy: validation
Validate before calling
def normalize(name: str) -> str:
return name.strip().lower()
spoken = 'HDMI 1'
sources = state.attributes.get('source_list', [])
ok = any(
normalize(s) == normalize(spoken)
or (spoken.endswith('1') and normalize(s) == normalize(spoken)[:-1])
for s in sources
)
if not ok:
# pick nearest or reject before Alexa call
... Type guard
def input_matches_source(spoken: str, source_list: list[str]) -> bool:
n = spoken.strip().lower()
return any(
s.strip().lower() == n or (n.endswith('1') and s.strip().lower() == n.rstrip('1'))
for s in source_list
) Try / catch
try:
await process_directive(directive)
except AlexaInvalidValueError:
_LOGGER.warning('Input %s not in source_list %s', media_input, entity.attributes.get('source_list')) Prevention
- Keep source_list names aligned with Alexa's spoken input vocabulary ('HDMI 1', not 'hdmi_1').
- Test select_source with the exact Alexa string in developer tools before voice use.
- After renaming sources, ask Alexa to rediscover devices.
When it happens
Trigger: An Alexa.ChangeChannel/Input selection whose payload input name does not match any entry in the media_player entity's source_list attribute after case normalization or trailing-'1' stripping. Typical when the TV/AVR reports sources with vendor-specific names ('hdmi', 'Game', 'Input1') while Alexa sends 'HDMI 1'.
Common situations: Broadlink/Android TV/AVR integrations exposing source lists with nonstandard names; renaming inputs on the device; users adding a ModeController for inputs where the friendly labels differ from the raw source_list strings.
Related errors
- ACTION_NOT_PERMITTED_FOR_CONTENT
- INVALID_DIRECTIVE
- TEMPERATURE_VALUE_OUT_OF_RANGE
- INVALID_TARGET_STATE
- UNSUPPORTED_THERMOSTAT_MODE
AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14).
Data as JSON: /api/errors/1b2fabdad5722d25.
Report an issue: GitHub.