pathwaycom/pathway · error · ValueError
Cannot enable interactive mode
Error message
Cannot enable interactive mode
What it means
enable_interactive_mode() refuses (ValueError 'Cannot enable interactive mode') when the global graph G.global_scope is not empty, i.e. some tables/operators were already built. Interactive mode must be switched on before any pathway computation is defined; it is also experimental and emits a warning. If a controller already exists it is returned idempotently instead of raising.
Source
Thrown at python/pathway/internals/interactive.py:213
def is_interactive_mode_enabled() -> bool:
graph = parse_graphs.G
return graph.interactive_mode_controller is not None
def enable_interactive_mode() -> InteractiveModeController:
warnings.warn("interactive mode is experimental", stacklevel=2)
graph = parse_graphs.G
if graph.interactive_mode_controller is not None:
return graph.interactive_mode_controller
if not graph.global_scope.is_empty():
# XXX: is this a correct test?
raise ValueError("Cannot enable interactive mode")
import logging
logging.basicConfig(level=logging.INFO)
graph.interactive_mode_controller = InteractiveModeController(
_pathway_internal=True
)
return graph.interactive_mode_controller
View on GitHub (pinned to fa2f74a464)
Solutions
- Call pw.internals.enable_interactive_mode() as the first pathway statement in the notebook/session, before defining any connectors or tables
- Restart the Python kernel / process to clear G.global_scope, then enable interactive mode first
- Move pipeline-building imports/code after the enable_interactive_mode() call
Example fix
# before
import pathway as pw
t = pw.debug.table_from_markdown('a\n1')
pw.internals.enable_interactive_mode() # ValueError
# after
import pathway as pw
pw.internals.enable_interactive_mode() # enable first
t = pw.debug.table_from_markdown('a\n1') Defensive patterns
Strategy: validation
Validate before calling
import pathway as pw
def ensure_interactive():
if not pw.internals.parse_graphs.G.global_scope.is_empty():
raise RuntimeError("restart kernel; interactive mode must be enabled before any pathway objects")
return pw.internals.enable_interactive_mode() Prevention
- Make enable_interactive_mode() the first pathway call in the notebook kernel's lifetime
- Keep pipeline definitions in functions you call after enabling interactive mode, not at import time
When it happens
Trigger: Calling pw.internals.enable_interactive_mode() (or the recompute()-style entry points that call it) after creating connectors, tables, or any pw.Table in the process; importing a module that defines a pipeline and then enabling interactive mode.
Common situations: Jupyter workflows where earlier cells already built tables; library imports that construct pathway pipelines at import time; second call in a fresh kernel after partial graph construction.
Related errors
- Join received extra kwargs. You probably want to use TableLi
- synchronization_group can only be set once
- Duplicate expression value given for {name}
- Cannot use expression as boolean.
- unit has to be one of s, ms, us, ns but is {unit}.
AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15).
Data as JSON: /api/errors/7b3258a0f57af3f4.
Report an issue: GitHub.