#29265·polars

pl.list fails to broadcast leading scalar input against column

Author: 0guban0vCreated Sep 11, 2026Updated Sep 15, 2026
LabelsbugpythonacceptedP-mediumA-dtype-list/array

Checks

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of Polars.

Reproducible example

python
import polars as pl
df = pl.DataFrame({"x": [10, 20, 30]})
print(df.select(pl.list(pl.lit(1), pl.col("x"))))

Log output

bash
polars.exceptions.ShapeError: can't broadcast Series 'x' of length 3 to length 1

This error occurred in the following expression:
        dyn int: 1.as_list([col("x")])

Issue description

pl.list behavior depends on argument order. Leading scalar fixes output length at one, later column cannot broadcast. Reversed inputs work df.select(pl.list(pl.col("x"), pl.lit(1)))

Expected behavior

shape: (3, 1)
┌───────────┐
│ literal   │
│ ---       │
│ list[i64] │
╞═══════════╡
│ [1, 10]   │
│ [1, 20]   │
│ [1, 30]   │
└───────────┘

Installed versions

--------Version info---------
Polars:              1.44.2
Index type:          UInt32
Platform:            macOS-26.6.2-arm64-arm-64bit-Mach-O
Python:              3.13.11 (main, Jan 19 2026, 13:46:40) [Clang 17.0.0 (clang-1700.6.3.2)]
Runtime:             rt32

----Optional dependencies----
Azure CLI            <not installed>
adbc_driver_manager  <not installed>
altair               <not installed>
azure.identity       <not installed>
boto3                <not installed>
cloudpickle          <not installed>
connectorx           <not installed>
deltalake            <not installed>
fastexcel            <not installed>
fsspec               <not installed>
gevent               <not installed>
google.auth          <not installed>
great_tables         <not installed>
matplotlib           <not installed>
numpy                <not installed>
openpyxl             <not installed>
pandas               <not installed>
polars_cloud         <not installed>
pyarrow              <not installed>
pydantic             <not installed>
pyiceberg            <not installed>
sqlalchemy           <not installed>
torch                <not installed>
xlsx2csv             <not installed>
xlsxwriter           <not installed>