{"record":{"id":"f70d10551146f728","repo":"pola-rs/polars","slug":"expected-a-type-argument","errorCode":null,"errorMessage":"expected a type argument","messagePattern":"expected a type argument","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pyo3-polars/pyo3-polars-derive/src/lib.rs","lineNumber":110,"sourceCode":"    })\n}\n\nfn create_expression_function(ast: syn::ItemFn) -> proc_macro2::TokenStream {\n    // count how often the user define a kwargs argument.\n    let args = ast\n        .sig\n        .inputs\n        .iter()\n        .skip(1)\n        .map(|fn_arg| {\n            if let FnArg::Typed(pat) = fn_arg {\n                if let syn::Pat::Ident(pat) = pat.pat.as_ref() {\n                    pat.ident.to_string()\n                } else {\n                    panic!(\"expected an argument\")\n                }\n            } 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}\"),","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/pola-rs/polars/blob/9b5d73fd00236295624374b075d16b1fe6ec6df9/pyo3-polars/pyo3-polars-derive/src/lib.rs#L92-L128","documentation":"Compile-time panic in the polars_expr proc macro: the function argument is not FnArg::Typed (e.g. a `self` receiver or malformed input), so no type annotation can be extracted for the generated expression wrapper.","triggerScenarios":"Thrown at pyo3-polars/pyo3-polars-derive/src/lib.rs:110 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a type argument, e.g. `#[polars_expr(output_type_func=...)]` with a type where one is expected."],"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"}