Let us make a precise minimal example first.
var("Y_{}{}".format(0,-16),latex_name="Y_{{{}-{}}}".format(0,-16))
This yields to the error as described in your question. The function "var" requires the provided name to be a valid Python identifier, thus the symbol "-" is not allowed as it is a reserved keyword.
We can check this using the isidentifier-method, which returns false if the provided String is not a valid Python identifier.
Calling the following to confirm
res="Y_{}{}".format(0,-16).isidentifier()
print(res)
Of course this returns False. In general, there is no way to use "var" with invalid Python identifiers, but there might be a trick. Looking at the source code on GitHub shows that after the "isidentifier"-check (take a look at lines 888-890) the call is delegated to "SR.symbol".
Hence for avoiding the above check, we could call
SR.symbol("Y_{}{}".format(0,-16),latex_name="Y_{{{}-{}}}".format(0,-16))
which yields to
Y_0-16
And using your provided example with SR.symbol:
m, n = 8, 8
Y = {(i,j): SR.symbol("Y_{}{}".format(i,j),latex_name="Y_{{{}{}}}".format(i,j))
for i in [0..m] for j in [(-2*n)..0]}
This yields to
{(0, -16): Y_0-16,
(0, -15): Y_0-15,
(0, -14): Y_0-14,
(0, -13): Y_0-13,
(0, -12): Y_0-12,
(0, -11): Y_0-11,
.
.
.
However, this might raise severe problems depending on your application and I would not necessarily recommend doing so (e.g. using this in different buildin methods will most likely yield in errors as sage does not expect this).