{"record":{"id":"16f581f4925236e5","repo":"hibernate/hibernate-orm","slug":"unable-to-create-the-sequence-the-increment-16f581","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/SpannerPostgreSQLSequenceSupport.java","lineNumber":27,"sourceCode":"\npublic class SpannerPostgreSQLSequenceSupport extends PostgreSQLSequenceSupport {\n\n\tprivate final SpannerPostgreSQLDialect dialect;\n\n\tpublic SpannerPostgreSQLSequenceSupport(SpannerPostgreSQLDialect dialect) {\n\t\tsuper();\n\t\tthis.dialect = dialect;\n\t}\n\n\t@Override\n\tpublic boolean supportsPooledSequences() {\n\t\treturn false;\n\t}\n\n\t@Override\n\tpublic 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+ startingValue( initialValue, incrementSize )\n\t\t\t+ \" start counter with \" + initialValue;\n\t}\n\n\t@Override\n\tpublic String getRestartSequenceString(String sequenceName, long startWith) {\n\t\treturn \"alter sequence \" + sequenceName + \" restart counter with \" + startWith;\n\t}\n\n\t@Override\n\tpublic String getSelectSequenceNextValString(String sequenceName) {\n\t\tvar nextValString = super.getSelectSequenceNextValString( sequenceName );\n\t\tif (dialect.useIntegerForPrimaryKey()) {\n\t\t\tnextValString = \"spanner.bit_reverse(\" + nextValString + \", true)\";\n\t\t}\n\t\treturn nextValString;","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/dialect/sequence/SpannerPostgreSQLSequenceSupport.java#L9-L45","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/SpannerPostgreSQLSequenceSupport.java:27 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a non-zero increment size for the sequence; Cloud Spanner requires a valid increment","Correct the @SequenceGenerator allocationSize so it is not 0"],"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"}