{"record":{"id":"6288d3eede356bcd","repo":"apache/cassandra","slug":"found-2-incompatible-versions-of-column-s-in-s","errorCode":null,"errorMessage":"Found 2 incompatible versions of column %s in %s.%s: one of type %s and one of type %s (but both types are incompatible)","messagePattern":"Found 2 incompatible versions of column (.+?) in (.+?)\\.(.+?): one of type (.+?) and one of type (.+?) \\(but both types are incompatible\\)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/rows/ColumnMetadataVersionComparator.java","lineNumber":80,"sourceCode":"        if (v1Type.isValueCompatibleWith(v2Type))\n        {\n            // Note: if both accept the same values, there is really no good way to prefer one over the other and so we\n            // consider them equal here. In practice, this mean we have 2 types that accepts the same values but are\n            // not equal. For internal types, TimestampType/DataType/LongType is, afaik, the only example, but as user\n            // can write custom types, who knows when this can happen. But excluding any user custom type weirdness\n            // (that would really be a bug of their type), such types should only differ in the way they sort, and as\n            // this method is only used for regular/static columns in practice, where sorting has no impact whatsoever,\n            // it shouldn't matter too much what we return here.\n            return v2Type.isValueCompatibleWith(v1Type) ? 0 : 1;\n        }\n        else if (v2Type.isValueCompatibleWith(v1Type))\n        {\n            return -1;\n        }\n        else\n        {\n            // Neither is a super type of the other: something is pretty wrong and we probably shouldn't ignore it.\n            throw new IllegalArgumentException(String.format(\"Found 2 incompatible versions of column %s in %s.%s: one \" +\n                                                             \"of type %s and one of type %s (but both types are incompatible)\",\n                                                             v1.name, v1.ksName, v1.cfName, v1Type, v2Type));\n        }\n    }\n}\n","sourceCodeStart":62,"sourceCodeEnd":86,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/rows/ColumnMetadataVersionComparator.java#L62-L86","documentation":"ColumnMetadataVersionComparator orders successive versions of a column definition during schema diffing (used to build type change histories). One version's type is expected to be a supertype/subtype of the other (e.g. text -> blob-style widening). If neither type is compatible with the other, the schema history is internally inconsistent and an IllegalArgumentException is thrown rather than silently producing a wrong ordering.","triggerScenarios":"Schema tables containing a column whose recorded type history has two mutually incompatible types (e.g. int then text); hand-edited or partially migrated system_schema entries; reading schema history of a table that was altered in an unsupported way or by a foreign tool.","commonSituations":"Unsupported ALTER TABLE type changes or direct edits to system_schema; restoring schema tables from a different cluster; Cassandra version bugs in schema migration; third-party migration tools writing schema rows directly.","solutions":["Inspect the column's recorded type history in system_schema and fix it to a valid progression, or recreate the table and re-import data.","Restore schema from a consistent snapshot (`nodetool snapshot` of system_schema or cqlsh DESCRIBE + full recreation).","Ensure all nodes agree on schema; run full repair of schema tables / restart nodes to re-sync.","Avoid direct edits or non-Cassandra tools writing to system_schema."],"exampleFix":"// before: incompatible history written directly\nINSERT INTO system_schema.columns ... type 'int' then 'text'\n// after: valid widening progression only\nALTER TABLE myks.mytable ALTER col TYPE blob; // int -> blob is a compatible widening","handlingStrategy":"try-catch","validationCode":"// check recorded column type history is a compatible widening before diffing\nif (!v1.type.asCQL3Type().isCompatibleWith(v2.type) && !v2.type.asCQL3Type().isCompatibleWith(v1.type)) throw new IllegalStateException(\"incompatible column history\");","typeGuard":null,"tryCatchPattern":"try { Collections.sort(versions, new ColumnMetadataVersionComparator()); } catch (IllegalArgumentException e) { restoreSchemaFromConsistentSnapshot(); }","preventionTips":["Never edit system_schema tables directly","Only use supported ALTER type progressions","Take schema snapshots before manual migrations"],"tags":["schema","type-mismatch","invariant","metadata"],"backgroundTag":"internal-invariant-violation","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}