pola-rs/polars · error · TypeError

profile() got an unexpected keyword argument

Error message

profile() got an unexpected keyword argument '{k}'

What it means

LazyFrame.profile() forwards keyword arguments to collect() and rejects unknown ones with this formatted message naming the offending key. Fires when calling profile() with a collect-only or misspelled keyword (e.g. no_optimization vs optimizations) that profile's signature does not accept.

Solutions

  1. Remove the unexpected keyword argument; check the profile() signature for valid parameters.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at py-polars/src/polars/lazyframe/frame.py:2179 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of pola-rs/polars@68506541d2 (2026-08-19). Data as JSON: /api/errors/ee1f40b2d6306942. Report an issue: GitHub.

Appendix: source

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

            self,
            optimizations=optimizations,
            background=background,
            post_opt_callback=post_opt_callback,
        )

    @overload
    def collect_async(
        self,
        *,
        gevent: Literal[True],
        engine: EngineType = "auto",
        optimizations: QueryOptFlags = DEFAULT_QUERY_OPT_FLAGS,
    ) -> _GeventDataFrameResult[DataFrame]: ...

    @overload
    def collect_async(
        self,
        *,
        gevent: Literal[False] = False,
        engine: EngineType = "auto",
        optimizations: QueryOptFlags = DEFAULT_QUERY_OPT_FLAGS,
    ) -> Awaitable[DataFrame]: ...

    @removed_parameters(
        RemovedParameter(
            name="streaming",
            deprecated_in="1.25.0",
            removed_in="2.0",
            hint='Use `engine="streaming"` instead.',
        )
    )
    def collect_async(
        self,
        *,
        gevent: bool = False,
        engine: EngineType = "auto",

View on GitHub (pinned to 68506541d2)