pola-rs/polars · error

'with' not set in join builder

Error message

'with' not set in join builder

What it means

Documentation-only record: JoinBuilder::finish (crates/polars-lazy/src/frame/mod.rs) reads self.other.expect("'with' not set in join builder") and panics when `other` was never provided. The guard catches builder misuse: you must call .with(<LazyFrame>) on the JoinBuilder before finish().

Solutions

  1. Call `.with(...)` on the join builder to provide the right-hand frame before building the join.
  2. Use the standard `join` API with both frames specified instead of the builder if simpler.
Defensive patterns

Strategy: validation

When it happens

Trigger: This panic/expect fires when execution reaches an unguarded state described by: "'with' not set in join builder". Typical triggers: unsupported dtype or feature-gated code path reached at runtime, invalid user input or environment variable value, calling API methods in the wrong order or on mismatched types, or data (lengths, offsets, ranges) violating the function's preconditions.

Common situations: Encountered when input data or configuration does not meet the preconditions of the throwing code path ("'with' not set in join builder"). Common cases: missing Cargo feature flags, mismatched dtypes/lengths between arrays or series, out-of-range temporal values, malformed environment variables, or operations on unsupported/complex nested types.


AI-assisted analysis of pola-rs/polars@5d8ebabf11 (2026-08-23). Data as JSON: /api/errors/6710a81d9a599652. Report an issue: GitHub.

Appendix: source

Thrown at crates/polars-lazy/src/frame/mod.rs:2242

        self
    }

    /// Whether to preserve the row order.
    pub fn maintain_order(mut self, maintain_order: MaintainOrderJoin) -> Self {
        self.maintain_order = maintain_order;
        self
    }

    /// Whether to prefer a specific build side.
    pub fn build_side(mut self, build_side: Option<JoinBuildSide>) -> Self {
        self.build_side = build_side;
        self
    }

    /// Finish builder
    pub fn finish(self) -> PolarsResult<LazyFrame> {
        let opt_state = self.lf.opt_state;
        let other = self.other.expect("'with' not set in join builder");

        let args = JoinArgs {
            how: self.how,
            validation: self.validation,
            suffix: self.suffix,
            slice: None,
            nulls_equal: self.nulls_equal,
            coalesce: self.coalesce,
            maintain_order: self.maintain_order,
            build_side: self.build_side,
        };

        let lp = self
            .lf
            .get_plan_builder()
            .join(
                other.logical_plan,
                self.left_on,

View on GitHub (pinned to 5d8ebabf11)