cocoindex-io/cocoindex · error · TypeError

LiveMapFeed sources require live mode. Pass live=True to app

Error message

LiveMapFeed sources require live mode. Pass live=True to app.update() or use a LiveMapView source that supports full scans.

What it means

LiveMapFeed.process requires its items source to be a LiveMapView, i.e. the run must be in live mode. In non-live (full-update) mode the feed would not receive change streams, so it raises TypeError telling you to pass live=True to app.update() or use a source supporting full scans.

Source

Thrown at python/cocoindex/_internal/live_component.py:578

class _MountEachLiveComponent:
    """Internal LiveComponent created by mount_each() for LiveMapFeed/LiveMapView items."""

    def __init__(
        self,
        items: LiveMapFeed[Any, Any],
        fn: Any,
        args: tuple[Any, ...],
        kwargs: dict[str, Any],
    ) -> None:
        self._items = items
        self._fn = fn
        self._args = args
        self._kwargs = kwargs

    async def process(self) -> None:
        if not isinstance(self._items, LiveMapView):
            raise TypeError(
                "LiveMapFeed sources require live mode. "
                "Pass live=True to app.update() or use a LiveMapView source that "
                "supports full scans."
            )
        from .api import mount

        async for key, value in self._items:
            await mount(
                ComponentSubpath(key), self._fn, value, *self._args, **self._kwargs
            )  # type: ignore[arg-type]

    async def process_live(self, operator: LiveComponentOperator) -> None:
        subscriber: LiveMapSubscriber[Any, Any] = LiveMapSubscriber(
            operator, self._fn, self._args, self._kwargs
        )
        await self._items.watch(subscriber)

View on GitHub (pinned to e84aa99b32)

Solutions

  1. Call await app.update(live=True) (or the live equivalent in your entry point) so sources are LiveMapViews.
  2. Use a LiveMapView-based source that supports the mode you're running.
  3. If a full batch update is intended, replace LiveMapFeed with a regular mount_each over a full scan.

Example fix

// before
app.update_blocking()
// after
await app.update(live=True)
Defensive patterns

Strategy: validation

Validate before calling

from cocoindex._internal.live_component import LiveMapView
if not isinstance(items, LiveMapView):
    raise TypeError("LiveMapFeed needs live=True or a full-scan source")

Type guard

def is_live_view(x) -> bool: return isinstance(x, LiveMapView)

Try / catch

try:
    await app.update()
except TypeError as e:
    if "LiveMapFeed" in str(e):
        await app.update(live=True)

Prevention

When it happens

Trigger: Running app.update() without live=True while the component's main function builds a LiveMapFeed from a non-LiveMapView items value (e.g. a static list or full-scan result).

Common situations: Adding a live map feed to a pipeline and still invoking the default blocking update; CI/scripts calling app.update_blocking() without the live flag.

Understand the failure class

Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.

Related errors


AI-assisted analysis of cocoindex-io/cocoindex@e84aa99b32 (2026-09-08). Data as JSON: /api/errors/675825b06f02314c. Report an issue: GitHub.