{"record":{"id":"3ee7c1ea67ff16be","repo":"deepset-ai/haystack","slug":"breakpointexception-from-triggered-breakpoint-brea","errorCode":null,"errorMessage":"BreakpointException.from_triggered_breakpoint(break_point=break_point)","messagePattern":"BreakpointException\\.from_triggered_breakpoint\\(break_point=break_point\\)","errorType":"exception","errorClass":"BreakpointException","httpStatus":null,"severity":"warning","filePath":"haystack/core/pipeline/pipeline.py","lineNumber":568,"sourceCode":"        \"\"\"\n        Executes a single component asynchronously.\n\n        If the component supports async execution, it is awaited directly as it will run async;\n        otherwise the component is offloaded to executor.\n\n        The method also updates the `visits` count of the component, writes outputs to `inputs_state`,\n        and returns pruned outputs that get stored in `pipeline_outputs`.\n\n        :param component_name: The name of the component.\n        :param component_inputs: Inputs for the component.\n        :returns: Outputs from the component that can be yielded from run_async_generator.\n        \"\"\"\n        if (\n            isinstance(break_point, Breakpoint)\n            and break_point.component_name == component_name\n            and break_point.visit_count == component_visits[component_name]\n        ):\n            raise BreakpointException.from_triggered_breakpoint(break_point=break_point)\n\n        instance: Component = component[\"instance\"]\n\n        with PipelineBase._create_component_span(\n            component_name=component_name, instance=instance, inputs=component_inputs, parent_span=parent_span\n        ) as span:\n            # deepcopy inputs before passing to the tracer so that even if a tracer mutates them\n            # the component always receives the original unmodified values\n            component_inputs_copy = _deepcopy_with_exceptions(component_inputs)\n            span.set_content_tag(_COMPONENT_INPUT, component_inputs)\n            logger.info(\"Running component {component_name}\", component_name=component_name)\n\n            try:\n                # For sync-only components, _run_component_async dispatches to a thread via asyncio.to_thread,\n                # which copies the current contextvars context — preserving e.g. the active tracing span.\n                outputs = await _execute_component_async(instance, **component_inputs_copy)\n            except Exception as error:\n                raise PipelineRuntimeError.from_exception(component_name, instance.__class__, error) from error","sourceCodeStart":550,"sourceCodeEnd":586,"githubUrl":"https://github.com/deepset-ai/haystack/blob/e318778c9bf60a1963e3b5f451359655dd696c30/haystack/core/pipeline/pipeline.py#L550-L586","documentation":"BreakpointException is raised in _run_component_async (pipeline.py:568) just before a component executes when the supplied Breakpoint matches the component about to run and its current visit count. It is Haystack's mechanism for interrupting a pipeline right before a specific component invocation so a snapshot can be taken. It is expected control flow for breakpoint-based debugging/human-in-the-loop flows, not corruption.","triggerScenarios":"pipeline.run/breakpoint run where break_point.component_name equals the component about to execute and break_point.visit_count equals that component's current visit count; also hit on resume when the caller passes a breakpoint that still matches the pre-execution state.","commonSituations":"Human-in-the-loop interruption before an LLM or tool call; intentionally pausing before the Nth visit of a looping component; miscounting visits of components inside cycles so the breakpoint fires earlier than expected.","solutions":["Catch BreakpointException and use its pipeline_snapshot to inspect state or persist and resume later.","If interruption was unintended, adjust visit_count (visits are 1-based per execution; cycles increment visits) or target a different component.","Remove the break_point argument for a normal uninterrupted run."],"exampleFix":"from haystack.core.errors import BreakpointException\ntry:\n    result = pipe.run(data, break_point=Breakpoint(component_name=\"llm\", visit_count=1))\nexcept BreakpointException as e:\n    snapshot = e.pipeline_snapshot  # save/resume instead of crashing\n","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from haystack.core.errors import BreakpointException\ntry:\n    result = pipe.run(data, break_point=bp)\nexcept BreakpointException as e:\n    snapshot = e.pipeline_snapshot  # inspect, persist, and resume later","preventionTips":["Treat BreakpointException as expected control flow in breakpoint runs and always handle it.","Verify visit_count semantics for components inside cycles (visits increment per execution).","Log the snapshot immediately when caught so state is not lost."],"tags":["pipeline","breakpoint","control-flow"],"backgroundTag":"intentional-breakpoint-interrupt","analyzedSha":"e318778c9bf60a1963e3b5f451359655dd696c30","analyzedAt":"2026-08-30T11:45:20.711Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}