I have posted an argument that there is no such magma before. It contained a mistake, however, so I had to delete it. The following argument is a revised and upgraded version of the previous one and should now hopefully show that there is indeed no such magma. (Satisfying the stricter conditions.)
Suppose that $G$ is an almost-group in your sense: we have an identity, all inverses, but precisely one association fails. In symbols: for precisely one triple $(a,b,c)$ of elements of $G$ we have that $(ab)c\neq a(bc)$. We shall see that this leads to a contradiction.
First I shall prove some lemmas.
Lemma 1. The identity element of $G$ is unique.
Proof. Suppose $e$ and $f$ are identity elements. Then $e = ef = f$, and we are done. $\square$
So, from this point on, $e$ will denote the identity.
Lemma 2. Suppose $d$ is an inverse of $b$, i.e. $bd=db=e$. Then either $d\neq a$ or $d\neq c$.
Proof. Otherwise we would have $a = d = c$, which would imply $(ab)c = (db)c = ec = c = a = ae = a(bd) = a(bc)$, which would contradict our assumption. $\square$
The lemma we have just proved, will allow us to split the various parts of the proof into two cases.
Lemma 3. Every element $x\in G$ has a unique inverse.
Proof. Let $y$ and $z$ be two inverses of $x$, i.e. $xy = yx = e$ and $xz=zx=e$. We shall examine two cases. First case: let $x\neq b$. Then $y(xy)=y(xz)$ and since $x\neq b$, this product associates, so $(yx)y=(yx)z$, which means $y = ey = ez = z$. Second case: let $x = b$. In this case, by lemma 2, either $y\neq a$ in which case $y(xy)=y(xz)$ (which is true by the assumptions of our lemma) will associate on both sides, again yielding $y = z$, or else $y \neq c$ in which case $(yx)y=(zx)y$ will associate on both sides and yield once again $y = z$. $\square$
So, from this point on, we will write $x^{-1}$ for the unique inverse of $x$.
Lemma 4. In $G$ the following implications hold:
- if $x\in G$ and $x^2 =x$, then $x=e$,
- if $b^{-1}\neq a$ and $xy=xz$, then $y=z$,
- if $b^{-1}\neq c$ and $yx=zx$, then $y=z$,
- if $x\in G$, then $(x^{-1})^{-1}=x$.
Proof. In all of these proofs we will use the fact that $(a,b,c)$ is the unique triple that does not associate:
- We shall again argue by cases: first, if $x\neq b$, we can just multiply by $x^{-1}$, which gives us $x^{-1}(xx)=x^{-1}x$. Here the first product associates, because $x\neq b$, giving us $(x^{-1}x)x=x^{-1}x$, which clearly says that $x=e$. If, on the other hand, $x = b$, we have $b^2=b$. If $b^{-1}\neq a$, this gives $b^{-1}(bb)=b^{-1}b$ and thus by associativity in this case: $b = e$. If $b^{-1} \neq c$, we instead examine $(bb)b^{-1}=bb^{-1}$, which again associates and gives us $b=e$.
- If $x\neq b$, the following equalities hold: $y = (x^{-1}x)y = x^{-1}(xy)= x^{-1}(xz) = (x^{-1}x)z = z$. If $x=b$, the same equalities hold, but this time for a different reason: $b^{-1}\neq a$.
- This can be proved completely symmetrically.
- This one is left as an exercise to the reader, and is again proved by examining the usual cases in pretty much the same way as before.
This concludes the proof. $\square$
Lemma 5. Suppose $(aa)c\neq a(ac)$ and $ac=a$. Then $aa\neq e$.
Proof. Suppose $aa=e$. Then by $(\dagger)$ from the paragraph below, $cc\neq c$, so $cc=(aa)(cc)=a(a(cc))=a((ac)c)=a(ac)=aa=e$. This further implies that $ca\neq e$, because that would imply $a=(ca)a=c(aa)=c$. Further still, $ca\neq c$, because this would imply $a=e$. (Multiply by $c^{-1}$ on the left.) Also, $ca\neq a$, since then $\lbrace e, a, b\rbrace$ would be a commutative submagma of $G$, which would imply $(aa)c=c(aa)=(ca)a=a(ca)=a(ac)$. So we may write $x=ca$, where $x\notin\lbrace e,a,b\rbrace$. We can calculate using the associations we have by our assumptions that this (if consistent at all; in fact it forces all sorts of contradictions) forces the following multiplication table for these elements:
$$\begin{array}{c | c c c c} & e & a & c & x\\\hline e & e & a & c & x \\ a & a & e & a & e \\ c & c & x & e & a \\ x & x & c & x & c \end{array}$$
But this would imply for example $(xx)x=a$ and $x(xx)=x$, a contradiction, since $(a,b,c)$ was supposed to be the only triple that does not associate. $\square$
Now, we shall derive a contradiction. In the following $|A|$ will denote the cardinality of the set $A$. Note that we can always assume that $e\notin\lbrace a,b,c\rbrace$, since otherwise the triple $(a,b,c)$ would associate, contrary to our assumptions. This knowledge together with the first point of lemma 4, tells us that $aa\neq a, bb\neq b \text{ and } cc\neq c\qquad (\dagger)$ which will be very useful in the following proofs.
Proposition 1. $|\lbrace a,b,c\rbrace|\neq 1$
Proof. Suppose $|\lbrace a,b,c\rbrace| = 1$. Then we have $a(aa)\neq(aa)a$. We can assume that $aa\neq a$ and $aa\neq e$, since otherwise $a(aa)=(aa)a$, contradicting our basic assumption. So, $aa=x\notin\lbrace e,a\rbrace$. Calculations thus show: $(ax)a^{-1}= a(xa^{-1})=a((aa)a^{-1})=a(a(aa^{-1}))=aa=x$. The third equality here is justified by $a^{-1}\neq a$, since $aa\neq e$. The others are easily seen. But this implies: $xa=((ax)a^{-1})a=(ax)(a^{-1}a)=ax$. The second inequality is again a consequence of $a\neq a^{-1}$. But since $x=aa$ by definition, $xa=ax$ contradicts our assumption. $\square$
Proposition 2. $|\lbrace a,b,c\rbrace|\neq 2$
Proof. Suppose $|\lbrace a,b,c\rbrace| = 2$. Then precisely one of the following holds: $a=b$, $b=c$ or $a=c$. We shall prove that each of these cases is in fact impossible.
First case: $a=b$. In this case we have $(aa)c\neq a(ac)$. The following equality is a consequence of $(\dagger)$: $((aa)c)c = (aa)(cc)=a(a(cc))$ and in $(a(ac))c=a((ac)c)=a(a(cc))$ the first equality is justified by noticing that it can only fail if $ac=b=a$ which by lemma 4 would imply either $c=e$, which isn't the case, or $aa=e$, which is disproved by lemma 5. The second equality is justified by the fact that $a\neq c$. So, strangely $((aa)c)c = (a(ac))c$. But since $c\neq b$, we can multiply by $c^{-1}$ on the right, use associativity and obtain $(aa)c=a(ac)$, a contradiction.
Second case: $b=c$. This one is disproved symmetrically as in the first case. (Using a lemma, symmetric to lemma 5.)
Third case: $a=c$. Here $a(ba)\neq (ab)a$. Multiplying by $b$, we see: $(a(ba))b=a((ba)b)=a(b(ab))=(ab)(ab)$, where the first two equalities follow from $a\neq b$ and the last one from $ab\neq a$, which is seen by multiplying by $a^{-1}$ from the left and using the fact that $b\neq a$. Also, $((ab)a)b=(ab)(ab)$, because $a\neq b$. So, $(a(ba))b = ((ab)a)b$. We multiply by $b^{-1}$ from the right, and use associativity, that follows from the fact that $b^{-1}\neq a$, which lemma 2 kindly provides us with, once again obtaining a contradiction.
This concludes the proof. $\square$
Proposition 3. $|\lbrace a,b,c\rbrace|\neq 3$
Proof. Because $a,b,c$ are distinct in this case, associations are justified a little more easily than before, so we will just write them down. If $ca\neq a$, we may use the following trick: $c((ab)c)=(c(ab))c=((ca)b)c=(ca)(bc)=c(a(bc))$ and multiplying by $c^{-1}$ and using the fact that $c\neq b$, we get $a(bc)=(ab)c$, a contradiction. If $ac\neq c$, a symmetric trick works. So we can assume without loss of generality, that $ac=c$ and $ca=a$. This implies $(ca)c=ac=c$ and $c(ac)=cc$, therefore $cc=c$ and $c=e$ by lemma 4, one last contradiction. $\square$
Now, the cardinality of $\lbrace a,b,c\rbrace$ is clearly $1,2$ or $3$, so these three propositions form a contradiction. This completes the argument.