{"record":{"id":"0f10226c5983d89f","repo":"hibernate/hibernate-orm","slug":"unrecognized-parameter-type-parameter","errorCode":null,"errorMessage":"Unrecognized parameter type : \" + parameter","messagePattern":"Unrecognized parameter type : \" \\+ parameter","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/procedure/internal/ProcedureParameterMetadataImpl.java","lineNumber":55,"sourceCode":"\tprivate ParameterStrategy parameterStrategy = ParameterStrategy.UNKNOWN;\n\tprivate List<ProcedureParameterImplementor<?>> parameters;\n\n\t@Override\n\tpublic void registerParameter(ProcedureParameterImplementor<?> parameter) {\n\t\tif ( parameter.isNamed() ) {\n\t\t\tif ( parameterStrategy == ParameterStrategy.POSITIONAL ) {\n\t\t\t\tthrow new IllegalArgumentException( \"Cannot mix named parameter with positional parameter registrations\" );\n\t\t\t}\n\t\t\tparameterStrategy = ParameterStrategy.NAMED;\n\t\t}\n\t\telse if ( parameter.isOrdinal() ) {\n\t\t\tif ( parameterStrategy == ParameterStrategy.NAMED ) {\n\t\t\t\tthrow new IllegalArgumentException( \"Cannot mix positional parameter with named parameter registrations\" );\n\t\t\t}\n\t\t\tparameterStrategy = ParameterStrategy.POSITIONAL;\n\t\t}\n\t\telse {\n\t\t\tthrow new IllegalArgumentException( \"Unrecognized parameter type : \" + parameter );\n\t\t}\n\t\tif ( parameters == null ) {\n\t\t\tparameters = new ArrayList<>();\n\t\t}\n\t\tparameters.add( parameter );\n\t}\n\n\t@Override\n\tpublic QueryParameterBindings createBindings(SessionFactoryImplementor sessionFactory) {\n\t\treturn QueryParameterBindingsImpl.from( this, sessionFactory );\n\t}\n\n\t@Override\n\tpublic void visitParameters(Consumer<QueryParameter<?>> consumer) {\n\t\tif ( parameters != null ) {\n\t\t\tparameters.forEach( consumer );\n\t\t}\n\t}","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/procedure/internal/ProcedureParameterMetadataImpl.java#L37-L73","documentation":"registerParameter only understands parameters that are named (isNamed(), name != null) or ordinal (isOrdinal(), position != null). A parameter with both null falls through to IllegalArgumentException 'Unrecognized parameter type'. This is an internal invariant violation: the public ProcedureCall.registerParameter overloads always set exactly one of the two.","triggerScenarios":"Registering a hand-built or proxied ProcedureParameterImplementor whose name and position are both null; a custom implementation of the internal SPI that failed to populate either field; a parameter object mutated (name/position cleared) after construction.","commonSituations":"Code that bypasses the public API and constructs parameter registrations directly against internal classes; a fork or patched Hibernate with a broken builder; extremely rare with the documented API.","solutions":["Use ProcedureCall#registerParameter overloads instead of constructing ProcedureParameterImplementor instances directly","If you implement the SPI, guarantee exactly one of getName()/getPosition() is non-null before registerParameter is invoked","Audit any code calling setName(null) or setPosition(null) on a registered parameter"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (param.getName() == null && param.getPosition() == null) {\n    throw new IllegalStateException(\"Procedure parameter must have a name or a position\");\n}\nmetadata.registerParameter(param);","typeGuard":null,"tryCatchPattern":"try {\n    metadata.registerParameter(param);\n} catch (IllegalArgumentException e) {\n    // internal invariant broken: name and position both null — fix the parameter construction\n}","preventionTips":["Use ProcedureCall#registerParameter instead of implementing the internal SPI","If you must build ProcedureParameterImplementor, assert exactly one of name/position is set","Never mutate a registered parameter to clear its name and position"],"tags":["hibernate","stored-procedure","parameter-registration","internal-api"],"backgroundTag":"invalid-parameter-registration","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}