pathwaycom/pathway · error · ValueError

demo.range_stream error: nb_rows should be strictly positive

Error message

demo.range_stream error: nb_rows should be strictly positive.

What it means

pw.io.airbyte.read supports exactly two execution types: "local" (run the connector docker image locally) and "remote" (run on GCP Cloud Run). Any other string for execution_type is rejected before any work starts.

Source

Thrown at python/pathway/demo/__init__.py:193

        nb_rows (int, optional): The number of rows to generate in the data stream. Defaults to 30.
        offset (int, optional): The offset value added to the generated 'value' column. Defaults to 0.
        input_rate (float, optional): The rate at which rows are generated per second. Defaults to 1.0.
        autocommit_duration_ms: the maximum time between two commits. Every
          autocommit_duration_ms milliseconds, the updates received by the connector are
          committed and pushed into Pathway Live Data Framework's computation graph.

    Returns:
        pw.Table: a table containing the generated data stream.

    Example:

    >>> table = pw.demo.range_stream(nb_rows=50, offset=10, input_rate=2.5)

    In the above example, an artificial data stream is generated with a single column 'value' and 50 rows.
    The 'value' column contains values ranging from 'offset' (10 in this case) to 'nb_rows' + 'offset' (60).
    """
    if nb_rows < 0:
        raise ValueError(
            "demo.range_stream error: nb_rows should be strictly positive."
        )

    class InputSchema(pw.Schema):
        value: float

    value_generators = {
        "value": (lambda x: float(x + offset)),
    }
    return generate_custom_stream(
        value_generators=value_generators,
        schema=InputSchema,
        autocommit_duration_ms=autocommit_duration_ms,
        nb_rows=nb_rows,
        input_rate=input_rate,
    )

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Set execution_type to "local" or "remote" exactly (lowercase).
  2. Use "local" when the connector image can run on the host; use "remote" only together with service_user_credentials_file.
  3. Omit execution_type if the default documented for your version is what you want.

Example fix

# before
pw.io.airbyte.read(..., execution_type="docker")

# after
pw.io.airbyte.read(..., execution_type="local")
Defensive patterns

Strategy: type-guard

Validate before calling

if execution_type not in {"local", "remote"}:
    raise ValueError("execution_type must be 'local' or 'remote'")
pw.io.airbyte.read(..., execution_type=execution_type)

Type guard

from typing import Literal, TypeGuard
ExecutionType = Literal["local", "remote"]

def is_execution_type(s: str) -> TypeGuard[ExecutionType]:
    return s in {"local", "remote"}

Prevention

When it happens

Trigger: Calling pw.io.airbyte.read(..., execution_type="docker"), "gcp", "cloud", or any typo/case variant such as "Local".

Common situations: User guesses a value based on the underlying transport (docker image / cloud run) instead of the documented enum; or an old tutorial used a value renamed in a newer Pathway release.

Related errors


AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15). Data as JSON: /api/errors/99914e24ee8b75aa. Report an issue: GitHub.