I got this error with django (AlterUniqueTogether) and mariadb when adding unique_together={('field1', 'field2')} constraint, where field2 was varchar(1000). Size of that field (1000x4) was too big for max index key length of 3072 bytes. field1 was fk so somehow i was getting that error and spent lot of time debugging it.