{"record":{"id":"db11422512ce9ef0","repo":"hibernate/hibernate-orm","slug":"unable-to-create-the-sequence-the-increment","errorCode":null,"errorMessage":"Unable to create the sequence [{}]: the increment size must not be 0","messagePattern":"Unable to create the sequence \\[(.+?)\\]: the increment size must not be 0","errorType":"exception","errorClass":"MappingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/dialect/sequence/SequenceSupport.java","lineNumber":195,"sourceCode":"\t * Overloaded form of {@link #getCreateSequenceString(String)}, additionally\n\t * taking the initial value and increment size to be applied to the sequence\n\t * definition.\n\t * </p>\n\t * The default definition is to suffix {@link #getCreateSequenceString(String)}\n\t * with the string: {@code start with initialValue increment by incrementSize}\n\t * for the arguments {@code initialValue} and {@code incrementSize}. Dialects\n\t * need to override this method if different key phrases are used to apply the\n\t * allocation information.\n\t *\n\t * @param sequenceName The name of the sequence\n\t * @param initialValue The initial value to apply to 'create sequence' statement\n\t * @param incrementSize The increment value to apply to 'create sequence' statement\n\t * @return The sequence creation command\n\t * @throws MappingException If sequences are not supported.\n\t */\n\tdefault String getCreateSequenceString(String sequenceName, int initialValue, int incrementSize) throws MappingException {\n\t\tif ( incrementSize == 0 ) {\n\t\t\tthrow new MappingException( \"Unable to create the sequence [\" + sequenceName + \"]: the increment size must not be 0\" );\n\t\t}\n\t\treturn getCreateSequenceString( sequenceName )\n\t\t\t\t+ startingValue( initialValue, incrementSize )\n\t\t\t\t+ \" start with \" + initialValue\n\t\t\t\t+ \" increment by \" + incrementSize;\n\t}\n\n\t/**\n\t * The multiline script used to drop a sequence.\n\t *\n\t * @param sequenceName The name of the sequence\n\t * @return The sequence drop commands\n\t * @throws MappingException If sequences are not supported.\n\t */\n\tdefault String[] getDropSequenceStrings(String sequenceName) throws MappingException {\n\t\treturn new String[]{ getDropSequenceString( sequenceName ) };\n\t}\n","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/dialect/sequence/SequenceSupport.java#L177-L213","documentation":"Error \"Unable to create the sequence [{}]: the increment size must not be 0\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown at hibernate-core/src/main/java/org/hibernate/dialect/sequence/SequenceSupport.java:195 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the sequence increment size to a non-zero value in the @SequenceGenerator allocationSize / increment definition","Remove the explicit increment=0 from the DDL or generator annotation"],"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"}