{"record":{"id":"74331c1ed0b64e44","repo":"pola-rs/polars","slug":"kwargs-context-order-should-be-reversed","errorCode":null,"errorMessage":"'kwargs', 'context' order should be reversed","messagePattern":"'kwargs', 'context' order should be reversed","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pyo3-polars/pyo3-polars-derive/src/lib.rs","lineNumber":127,"sourceCode":"            } else {\n                panic!(\"expected a type argument\")\n            }\n        })\n        .collect::<Vec<_>>();\n\n    let fn_name = &ast.sig.ident;\n\n    // Get the tokenstream of the call logic.\n    let quote_call = match args.len() {\n        0 => quote_call_no_kwargs(&ast, fn_name),\n        1 => match args[0].as_str() {\n            \"kwargs\" => quote_call_kwargs(&ast, fn_name),\n            \"context\" => quote_call_context(&ast, fn_name),\n            a => panic!(\"didn't expect argument {a}\"),\n        },\n        2 => match (args[0].as_str(), args[1].as_str()) {\n            (\"context\", \"kwargs\") => quote_call_context_kwargs(&ast, fn_name),\n            (\"kwargs\", \"context\") => panic!(\"'kwargs', 'context' order should be reversed\"),\n            (a, b) => panic!(\"didn't expect arguments {a}, {b}\"),\n        },\n        _ => panic!(\"didn't expect so many arguments\"),\n    };\n\n    let quote_process_result = quote_process_results();\n    let fn_name = get_expression_function_name(fn_name);\n\n    quote!(\n        use ::pyo3_polars::export::*;\n\n        // create the outer public function\n        #[no_mangle]\n        pub unsafe extern \"C\" fn #fn_name (\n            e: *mut polars_ffi::version_0::SeriesExport,\n            input_len: usize,\n            kwargs_ptr: *const u8,\n            kwargs_len: usize,","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/pola-rs/polars/blob/9b5d73fd00236295624374b075d16b1fe6ec6df9/pyo3-polars/pyo3-polars-derive/src/lib.rs#L109-L145","documentation":"Compile-time panic in the polars_expr proc macro: with two special parameters the order was ('kwargs', 'context'), but the macro only accepts them as ('context', 'kwargs') — context must come first in the function signature.","triggerScenarios":"Thrown at pyo3-polars/pyo3-polars-derive/src/lib.rs:127 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reverse the order so that 'context' comes before 'kwargs' in the argument list."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9b5d73fd00236295624374b075d16b1fe6ec6df9","analyzedAt":"2026-08-19T12:15:06.350Z","contentChangedAt":"2026-08-19T12:15:06.350Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}