pola-rs/polars · warning · ValueError

`limit` cannot be None. If you want to show the complete laz

Error message

`limit` cannot be None. If you want to show the complete lazyframe, call `.collect().show()` on it.

What it means

LazyFrame.show renders a bounded preview; a lazyframe is not materialized, so limit=None (which in DataFrame.show means 'show everything') is rejected with a ValueError that redirects you to .collect().show() for the full table.

Source

Thrown at py-polars/src/polars/lazyframe/frame.py:9972

        │ 2   ┆ 8   │
        │ 3   ┆ 9   │
        │ 4   ┆ 10  │
        │ 5   ┆ 11  │
        └─────┴─────┘
        >>> lf.show(2)
        shape: (2, 2)
        ┌─────┬─────┐
        │ a   ┆ b   │
        │ --- ┆ --- │
        │ i64 ┆ i64 │
        ╞═════╪═════╡
        │ 1   ┆ 7   │
        │ 2   ┆ 8   │
        └─────┴─────┘
        """
        if limit is None:
            msg = "`limit` cannot be None. If you want to show the complete lazyframe, call `.collect().show()` on it."
            raise ValueError(msg)

        self.head(limit).collect(engine="streaming").show(
            limit,
            ascii_tables=ascii_tables,
            decimal_separator=decimal_separator,
            thousands_separator=thousands_separator,
            float_precision=float_precision,
            fmt_float=fmt_float,
            fmt_str_lengths=fmt_str_lengths,
            fmt_table_cell_list_len=fmt_table_cell_list_len,
            tbl_cell_alignment=tbl_cell_alignment,
            tbl_cell_numeric_alignment=tbl_cell_numeric_alignment,
            tbl_cols=tbl_cols,
            tbl_column_data_type_inline=tbl_column_data_type_inline,
            tbl_dataframe_shape_below=tbl_dataframe_shape_below,
            tbl_formatting=tbl_formatting,
            tbl_hide_column_data_types=tbl_hide_column_data_types,
            tbl_hide_column_names=tbl_hide_column_names,

View on GitHub (pinned to df599052da)

Solutions

  1. Call lf.collect().show() to materialize and display the full table
  2. Or pass an explicit integer bound: lf.show(100)
  3. In shared helpers, branch: if isinstance(frame, pl.LazyFrame) and limit is None: frame = frame.collect()

Example fix

// before
lf.show(None)

// after
lf.collect().show()  # full table
lf.show(100)         # or a bounded lazy preview
Defensive patterns

Strategy: validation

Validate before calling

if isinstance(frame, pl.LazyFrame):
    if limit is None:
        frame = frame.collect()   # then show(None) is fine
frame.show(limit)

Type guard

def lazy_show_safe(frame, limit=None):
    if isinstance(frame, pl.LazyFrame) and limit is None:
        return frame.collect().show()
    return frame.show(limit)

Prevention

When it happens

Trigger: lf.show(None); passing limit=None programmatically in helpers shared between pl.DataFrame and pl.LazyFrame; copying eager-frame show(None) habits to lazy frames.

Common situations: Code reused across eager/lazy frames; users expecting DataFrame.show semantics; attempting to dump an entire (possibly unbounded) lazy result.

Related errors


AI-assisted analysis of pola-rs/polars@df599052da (2026-08-16). Data as JSON: /api/errors/1812d58c601e49a6. Report an issue: GitHub.