{"record":{"id":"9af75103001fa5ff","repo":"home-assistant/core","slug":"validation-error","errorCode":"validation-error","errorMessage":"Invalid stage combination: start={start_stage}, end={end_stage}","messagePattern":"Invalid stage combination: start=(.+?), end=(.+?)","errorType":"exception","errorClass":"InvalidPipelineStagesError","httpStatus":null,"severity":"error","filePath":"homeassistant/components/assist_pipeline/pipeline.py","lineNumber":608,"sourceCode":"\n    _intent_agent_only = False\n    \"\"\"If request should only be handled by agent.\n\n    Ignores sentence triggers and local processing.\n    \"\"\"\n\n    _streamed_response_text = False\n    \"\"\"If the conversation agent streamed response text to TTS result.\"\"\"\n\n    def __post_init__(self) -> None:\n        \"\"\"Set language for pipeline.\"\"\"\n        self.language = self.pipeline.language or self.hass.config.language\n\n        # wake -> stt -> intent -> tts\n        if PIPELINE_STAGE_ORDER.index(self.end_stage) < PIPELINE_STAGE_ORDER.index(\n            self.start_stage\n        ):\n            raise InvalidPipelineStagesError(self.start_stage, self.end_stage)\n\n        pipeline_data = self.hass.data[KEY_ASSIST_PIPELINE]\n        if self.pipeline.id not in pipeline_data.pipeline_debug:\n            pipeline_data.pipeline_debug[self.pipeline.id] = LimitedSizeDict(\n                size_limit=STORED_PIPELINE_RUNS\n            )\n        pipeline_data.pipeline_debug[self.pipeline.id][self.id] = PipelineRunDebug()\n        pipeline_data.pipeline_runs.add_run(self)\n\n        # Initialize with audio settings\n        if self.audio_settings.needs_processor and (self.audio_enhancer is None):\n            # Default audio enhancer\n            self.audio_enhancer = MicroVadSpeexEnhancer(\n                self.audio_settings.auto_gain_dbfs,\n                self.audio_settings.noise_suppression_level,\n                self.audio_settings.is_vad_enabled,\n            )\n","sourceCodeStart":590,"sourceCodeEnd":626,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/assist_pipeline/pipeline.py#L590-L626","documentation":"InvalidPipelineStagesError raised in PipelineRun.__post_init__ when the requested run stages are misordered: in the wake -> stt -> intent -> tts pipeline, the end stage appears before the start stage in PIPELINE_STAGE_ORDER, so the run would be empty/negative. Its message ('Invalid stage combination: start={start_stage}, end={end_stage}') carries the offending pair.","triggerScenarios":"Constructing PipelineRun with e.g. start_stage='intent' and end_stage='stt', or passing stage names from websocket options that were not validated (including case mismatches yielding wrong indices indirectly).","commonSituations":"Programmatic pipeline runs with hand-built stage arguments; frontends exposing free-text stage pickers; code updated after stage constants were renamed/reordered.","solutions":["Order stages along wake -> stt -> intent -> tts (start must not come after end).","Validate stage names and order against PIPELINE_STAGE_ORDER before constructing PipelineRun.","If you only need a suffix/slice of the pipeline, pick start/end from the ordered constant list programmatically."],"exampleFix":"# before\nrun = PipelineRun(hass, pipeline, start_stage=\"intent\", end_stage=\"stt\")\n# after\nrun = PipelineRun(hass, pipeline, start_stage=\"stt\", end_stage=\"tts\")","handlingStrategy":"validation","validationCode":"from homeassistant.components.assist_pipeline.pipeline import PIPELINE_STAGE_ORDER\n\ndef stages_valid(start: str, end: str) -> bool:\n    return PIPELINE_STAGE_ORDER.index(end) >= PIPELINE_STAGE_ORDER.index(start)","typeGuard":null,"tryCatchPattern":"Validate stage order (or catch InvalidPipelineStagesError) when accepting user-specified run stages, and normalize/reject before constructing PipelineRun.","preventionTips":["Derive start/end stages from PIPELINE_STAGE_ORDER instead of free-text.","Use fixed stage pairs (wake..tts, stt..tts) in callers.","Test stage configs after upgrading HA, as stage constants can evolve."],"tags":["home-assistant","assist-pipeline","validation","pipeline-stages"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}