It's well known that the action of subtraction isn't associative:
$(7-4)-1 \neq 7-(4-1)$
However, subtraction is simply the addition of negative numbers... so the inequality above can be presented as:
$(7+(-4))+(-1) \neq 7+(-1)\cdot(4+(-1))$
So, since addition is associative, and the latter inequality shows a non-associative addition - what went wrong?
The latter one doesn't show non-associative addition. Associativity says the following: $$(7+(-4))+(-1)=7+((-4)+(-1))$$ That is, you need to consider $7$ and $-4$ and $-1$ all as single terms, which cannot be broken apart. So, your manipulation is incorrect, since you pulled the $-$ and the $4$ apart when applying associativity.
Otherwise stated, the operation of moving from $a-(b-c)$ to $(a-b)-c$ does not correspond to a regrouping of terms in the relevant addition; in the first one, $c$ is getting negated twice before the sum and in the latter, it is negated only once, so the summands are materially different between the two sums, which is why associativity does not apply.