I feels like there is something buggy going on here.
Here is the original expression that yields the error message reported.
NMaximize[{10 (-d[1] + d[2])^4 q[1, 2]^4 + (-d[1] + d[2])^2 q[1,
2]^2 (4 q[1, 2]^2 + (q[1, 1] - q[2, 2])^2) -
6 (d[1] - d[2])^3 q[1,
2]^2 (q[1, 1] - q[2, 2]) (d[1] q[1, 1] + d[2] q[2, 2]) +
2 (d[1] - d[2])^4 q[1, 2]^2 (d[1] q[1, 1] + d[2] q[2, 2])^2,
d[1]^2 + d[2]^2 == 1,
q[1, 1]^2 + 2 q[1, 2]^2 + q[2, 2]^2 == 1}, {q[1, 1], q[1, 2],
q[2, 2], d[1], d[2]}]
Let's try to get rid of the problem by defining the functions d and q to replace themselves by symbols as in this:
d[i_] := ToExpression["d" <> ToString[i]];
q[i_, j_] := ToExpression["q" <> ToString[i] <> ToString[j]];
When we do this the original NMaximize problem above still yields the error message.
Ok, let's try the expression with the substitutions evaluated in the arguments of NMaximize as in this:
NMaximize[{10 (-d1 + d2)^4 q12^4 + (-d1 +
d2)^2 q12^2 (4 q12^2 + (q11 - q22)^2) -
6 (d1 - d2)^3 q12^2 (q11 - q22) (d1 q11 + d2 q22) +
2 (d1 - d2)^4 q12^2 (d1 q11 + d2 q22)^2, d1^2 + d2^2 == 1,
q11^2 + 2 q12^2 + q22^2 == 1}, {q11, q12, q22, d1, d2}]
This still gives the error message. Hmmmm.... ok, let's add some rules to the definitions for the functions d and q so that they just evaluate to the parameters that are given in Laslo's 2nd example that works out correctly:
d[1] := x;
d[2] := y;
q[1, 1] := a;
q[1, 2] := b;
q[2, 2] := c;
Now when we execute
NMaximize[{10 (-d[1] + d[2])^4 q[1, 2]^4 + (-d[1] + d[2])^2 q[1,
2]^2 (4 q[1, 2]^2 + (q[1, 1] - q[2, 2])^2) -
6 (d[1] - d[2])^3 q[1,
2]^2 (q[1, 1] - q[2, 2]) (d[1] q[1, 1] + d[2] q[2, 2]) +
2 (d[1] - d[2])^4 q[1, 2]^2 (d[1] q[1, 1] + d[2] q[2, 2])^2,
d[1]^2 + d[2]^2 == 1,
q[1, 1]^2 + 2 q[1, 2]^2 + q[2, 2]^2 == 1}, {q[1, 1], q[1, 2],
q[2, 2], d[1], d[2]}]
no error message is generated and the correct answer is returned.
It is odd that using the variables {d1, d2, q11, q12, q22} give the error message while using {x,y,a, b, c} do not.
It smells like a bug but the possibilities that Sean is suggesting would still be in play here -- especially the issue of sorting the expression form. [Note that I edited my post to correct my earlier statement that Sean's comments may not cover my example. They well may.]