{"record":{"id":"3556a13c713114af","repo":"hibernate/hibernate-orm","slug":"collection-must-be-not-null","errorCode":null,"errorMessage":"Collection must be not null","messagePattern":"Collection must be not null","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/internal/FilterImpl.java","lineNumber":137,"sourceCode":"\t\t\tparameters = new TreeMap<>();\n\t\t}\n\t\tparameters.put( name, argument );\n\t\tvalidated = false;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set the named parameter's value list for this filter.  Used\n\t * in conjunction with IN-style filter criteria.\n\t *\n\t * @param name   The parameter's name.\n\t * @param values The values to be expanded into an SQL IN list.\n\t * @return This FilterImpl instance (for method chaining).\n\t */\n\tpublic Filter setParameterList(String name, Collection<?> values) throws HibernateException  {\n\t\t// Make sure this is a defined parameter and check the incoming value type\n\t\tif ( values == null ) {\n\t\t\tthrow new IllegalArgumentException( \"Collection must be not null\" );\n\t\t}\n\t\tfinal var type = definition.getParameterJdbcMapping( name );\n\t\tif ( type == null ) {\n\t\t\tthrow new HibernateException( \"Undefined filter parameter '\" + name + \"'\" );\n\t\t}\n\t\tif ( !values.isEmpty() ) {\n\t\t\tfinal Object element = values.iterator().next();\n\t\t\tif ( !type.getJavaTypeDescriptor().isInstance( element ) ) {\n\t\t\t\tthrow new IllegalArgumentException( \"Argument assigned to filter parameter '\" + name\n\t\t\t\t\t\t+ \"' is not of type '\" + type.getJavaTypeDescriptor().getTypeName() + \"'\" );\n\t\t\t}\n\t\t}\n\t\tif ( parameters == null ) {\n\t\t\tparameters = new TreeMap<>();\n\t\t}\n\t\tparameters.put( name, values );\n\t\tvalidated = false;\n\t\treturn this;","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/internal/FilterImpl.java#L119-L155","documentation":"Error \"Collection must be not null\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown when a caller passes a null Collection to the API guarded in FilterImpl.java:137.","commonSituations":"Typical situations: calling the method with an uninitialized variable; a lookup that returned null being passed straight through; missing null-checks in application code before invoking Hibernate.","solutions":["Pass a non-null collection to the filter's collection 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"}