{"record":{"id":"4b7d303c8bb77529","repo":"PRQL/prql","slug":"parameter-expanding-expected-a-boolean-found","errorCode":null,"errorMessage":"parameter `expanding`: expected a boolean, found {found}","messagePattern":"parameter `expanding`: expected a boolean, found (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"prqlc/prqlc/src/semantic/resolver/transforms.rs","lineNumber":167,"sourceCode":"                    // fold, so lineage and types are inferred\n                    self.fold_expr(partition)?\n                };\n                let pipeline = self.fold_by_simulating_eval(pipeline, &partition)?;\n\n                // unpack tbl back out\n                let tbl = *partition.kind.into_transform_call().unwrap().input;\n\n                let pipeline = Box::new(pipeline);\n                (TransformKind::Group { by, pipeline }, tbl)\n            }\n            \"window\" => {\n                let [rows, range, expanding, rolling, pipeline, tbl] = unpack::<6>(func.args);\n\n                let expanding = {\n                    let as_bool = expanding.kind.as_literal().and_then(|l| l.as_boolean());\n\n                    *as_bool.ok_or_else(|| {\n                        Error::new(Reason::Expected {\n                            who: Some(\"parameter `expanding`\".to_string()),\n                            expected: \"a boolean\".to_string(),\n                            found: write_pl(expanding.clone()),\n                        })\n                        .with_span(expanding.span)\n                    })?\n                };\n\n                let rolling = {\n                    let as_int = rolling.kind.as_literal().and_then(|x| x.as_integer());\n\n                    *as_int.ok_or_else(|| {\n                        Error::new(Reason::Expected {\n                            who: Some(\"parameter `rolling`\".to_string()),\n                            expected: \"a number\".to_string(),\n                            found: write_pl(rolling.clone()),\n                        })\n                        .with_span(rolling.span)","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/PRQL/prql/blob/e164e249b99485890036eb60f57c37520379b240/prqlc/prqlc/src/semantic/resolver/transforms.rs#L149-L185","documentation":"In the `window` transform, the `expanding` parameter must be a boolean literal (`true` or `false`). The resolver attempts to read the argument as a boolean literal and throws this error when it is any other kind of expression or literal. The found value is pretty-printed to help spot the mistake.","triggerScenarios":"Calling `window` with `expanding:` set to a non-boolean literal, e.g. `window expanding:1 ...`, `expanding:\"yes\"`, or an interpolated/computed expression instead of `true`/`false`.","commonSituations":"Passing 1/0 like some SQL dialects accept; quoting the value; writing `expanding` without a value so it becomes a non-boolean expression; typo'ing a variable so an expression is passed.","solutions":["Pass the literal `true` or `false` for `expanding:`","Remove the parameter entirely if not needed (window has defaults)","Use `rolling:` with a number instead if a fixed-size window was intended"],"exampleFix":"// before\nwindow expanding:1 (sum amount)\n// after\nwindow expanding:true (sum amount)","handlingStrategy":"validation","validationCode":"const expanding = true;\nif (typeof expanding !== \"boolean\") {\n  throw new Error(\"expanding must be a boolean literal\");\n}","typeGuard":"const isBool = (v) => typeof v === \"boolean\";","tryCatchPattern":"try { prql_compile(query); } catch (e) { if (e.message.includes(\"parameter `expanding`\")) { /* fix expanding arg to true/false */ } else { throw e; } }","preventionTips":["Use true/false, never 1/0","Do not quote boolean values","Omit expanding entirely unless you need a cumulative window"],"tags":["prql","window","type-mismatch","validation"],"backgroundTag":"type-mismatch","analyzedSha":"e164e249b99485890036eb60f57c37520379b240","analyzedAt":"2026-09-09T12:18:38.727Z","contentChangedAt":"2026-09-09T12:18:38.727Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}