INSERTing explicitly to specific partition immediately after running ANALYZE TABLE in a MyISAM or Aria table partitioned by HASH with an AUTOINCREMENT column causes the AUTOINCREMENT value to revert to the original CREATE TABLE value, resulting in duplicate values.
This happens when the table is MyISAM, has at least 2 partitions, and the inserts are done first to one partition, and immediately after running ANALYZE TABLE, INSERTs are done to another partition, and all inserts are done to specific partitions of a table partitioned by HASH.
Any statement that touches table metadata, such as a SELECT from the table or a SHOW CREATE TABLE, makes it so the subsequent INSERT works correctly, but an INSERT into an empty partition, done immediately after an ANALYZE TABLE, always produces this error.
Changing engines to either Aria or InnoDB has no effect in 10.2 servers (they still work correctly). However, in 10.3 and 10.4 servers using either Aria or InnoDB for the test results in a server crash on the first insert operation.