I'm not yet able to reproduce the problem. I've tried two different product configurations. One where the product had multiple attributes and a group of attributes were assigned to offer a variant for each configuration. I've also gone to a product that had one attribute similar to the product in the image. I tried with mixed attributes as well as without and even applied a maximum number of product from which to select and was not able to reproduce the issue when the product quantity was synchronized with the number of product. Meaning if there were 2 size 12-18 and 1 of size 6-12 then the total quantity in stock for the product should be 3 as far as being synchronized. No matter how I approached modifying the quantity in the cart (modify on the shopping cart page or by trying to add from the product information page), I was always advised that the quantity was adjusted for the maximum quantity in stock and the value last modified was again updated to prevent exceeding either the total product in stock or the total for that attribute. I also repeated this by swapping the quantity available of the two attributes (in case there was some sort of sequence issue that was causing a problem) and didn't get a different result. Now I didn't try adding those product in reverse order, but...
Now... When I reduced the total quantity of the product to be less than the synchronized quantity (ie. in the above if the total product quantity were 3 and the quantity available of size 12-18 were increased to 3 (by attribute 4 available, but by product only 3), then I was able to get the error message that you describe as soon as I refreshed the cart where it already had quantity in it that exceeded the total quantity of the available product (I actually did quantities differently than provided above where I had 1 and 3 instead of 1 and 2, then my original total quantity was 4. When I had in cart 1 and 3 of the respective product, then reduced the total quantity available (simulating someone purchased a product but the individual attribute quantity hadn't been reduced) then I had an error message for both product (or any quantity product that had the same products_id basically) that the product was out-of-stock. If I reduced my quantity of 3 down to a quantity of 2, then the message disappeared, but if I then increased the quantity to 3 again, the error message again appeared.
So, it would seem to me that the issue is that at the time this occurs, there is a discrepancy between the sum of the quantity of attribute variants and the total product available such that the total quantity of product is less than the quantity for the applicable attribute product. As far as what to do in this situation, I'm certainly open to suggestions, I can tell you that there is a conflict in information at that point... What is the limiting factor? The quantity of attribute type product or the total quantity of product? How should the cart respond? If I'm allowed to pick X and Y items out of bag but the bag has some number less than the total of X and Y items, what should "auto" change the one that has the higher quantity, the one that was last modified (how can one tell which is last modified if both are modified on a single screen refresh)? Dump the changes made and just return back to whatever was last entered? (Think of having a long list of items, having determined just the right balance, selecting update cart and all the work done disappears? Not a good experience.) Should one reduce down to the lowest quantity permitted and then the other? Which one? "Higher quantity?" (What if both have the same quantity entered?) Last one added? Why should it get priority of reducing quantity?
Okay, anyways, open to suggestions and ideas, just know that there are more questions than answers in some cases.. Some would say why even allow that type of discrepancy to exist? Why not? Could work for some stores...
Now I didn't try with my store set to allow over-selling product, so that could be a condition you have set for yours, I don't know unless the settings associated with stock and SBA are shared.
Oh, I'm also going to compare my fileset to the github fileset which I presume you downloaded:
https://github.com/mc12345678/Stock_...butes_Combined as the source was not identified and some older versions certainly had issues.