{"record":{"id":"d2f0df2009282158","repo":"hibernate/hibernate-orm","slug":"parameter-d-of-function-s-does-not-permit-un","errorCode":null,"errorMessage":"Parameter %d of function '%s()' does not permit untyped expressions like null literals. Please cast the expression to a type","messagePattern":"Parameter (.+?) of function '(.+?)\\(\\)' does not permit untyped expressions like null literals\\. Please cast the expression to a type","errorType":"exception","errorClass":"FunctionArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/sqm/produce/function/ArgumentTypesValidator.java","lineNumber":111,"sourceCode":"\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t// the following are not really necessary for the functions we have today\n\t\t\t\t\t// since collations and trim specifications have special parser rules,\n\t\t\t\t\t// but at the very least this is an assertion that we don't get given\n\t\t\t\t\t// something crazy by the parser\n\t\t\t\t\tcase TRIM_SPEC:\n\t\t\t\t\t\tif ( !(argument instanceof SqmTrimSpecification) ) {\n\t\t\t\t\t\t\tthrowError(parameterType, Object.class, null, functionName, count);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase COLLATION:\n\t\t\t\t\t\tif ( !(argument instanceof SqmCollation) ) {\n\t\t\t\t\t\t\tthrowError(parameterType, Object.class, null, functionName, count);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase NO_UNTYPED:\n\t\t\t\t\t\tif ( argument instanceof SqmLiteralNull<?> ) {\n\t\t\t\t\t\t\tthrow new FunctionArgumentException(\n\t\t\t\t\t\t\t\t\tString.format(\n\t\t\t\t\t\t\t\t\t\t\t\"Parameter %d of function '%s()' does not permit untyped expressions like null literals. Please cast the expression to a type\",\n\t\t\t\t\t\t\t\t\t\t\tcount,\n\t\t\t\t\t\t\t\t\t\t\tfunctionName\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t//TODO: appropriate error?\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate void checkArgumentType(\n\t\t\tString functionName,","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/function/ArgumentTypesValidator.java#L93-L129","documentation":"Error \"Parameter %d of function '%s()' does not permit untyped expressions like null literals. Please cast the expression to a type\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A function call in a query supplies arguments that violate the function's signature.","commonSituations":"Passing the wrong number or types of arguments (e.g. untyped nulls, tuples) to HQL/SQL functions.","solutions":["An untyped expression (e.g. a null literal) was passed where the function parameter requires a typed value.","Cast the expression, e.g. cast(null as String), or pass a typed parameter."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}