question

dragonfoundry avatar image
dragonfoundry asked

StatisticNameConflict

Got the following error on our server:

PlayFabError: StatisticNameConflict, message: A statistic with the specified name already exists, details: , httpcode: 400, httperror: BadRequest, user: 1496FF3D832B2544

The only call in the API that returns this error is CreatePlayerStatisticDefinition, and we don't call that. The only statistic calls we make are to update player statistics and get player statistics.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

Actually, you'll also get that error if you try to call UpdatePlayerStatistics to write to a new statistic which differs from an existing statistic only in the use of upper/lower case. So, if your game has a statistic named "Foo" already, you would get this error if you tried to call UpdatePlayerStatistics to write to a statistic named "foo".

4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

dragonfoundry avatar image dragonfoundry commented ·

Ugh. That's "Worst Case Sensitive" (case sensitive, but will fail based on an internal case insensitive operation).

It's also not specified in any of the documentation - UpdatePlayerStatistics isn't listed as returning that error, and nowhere in the statistics section does it list case sensitivity.

This isn't what's going on with us, however, as all our UpdatePlayerStatistics are exclusively lower case.

0 Likes 0 ·
brendan avatar image brendan dragonfoundry commented ·

It's definitely a fair point that we need to clarify that statistics are case sensitive - I'll get that added to the docs.

For what you're seeing, can you please provide the specific repro steps? Which Title ID are you testing, and what is the exact name of the statistic you're trying to write to?

0 Likes 0 ·
dragonfoundry avatar image dragonfoundry commented ·

Title ID is 721f. I can't tell the exact statistic - it was a one-time error we saw in the server logs (which, sadly, didn't include all the error details). Maybe your error logs can spot it - it's not an error I've seen before on our titles.

0 Likes 0 ·
brendan avatar image brendan dragonfoundry commented ·

Unfortunately, no - it's not really possible for us to keep all errors for all titles long-term, as it's cost prohibitive. If you can get a repro case, we could certainly work with you on checking the results, but from reviewing the code, the only way that error should be returned is if: a) the statistic specified is not found in the set of existing stats for the title, and then b) it nevertheless matches an existing statistic definition, when compared with InvariantCultureIgnoreCase.

0 Likes 0 ·
chris-3 avatar image
chris-3 answered

Are there any other ways that this can happen?

My case, we are migrating users to new title under our publisher. I've created a routine that read the stats from the old account then writes them out to the new account.

One time in the tests, out of maybe 30, I got this error.

I'm using Update not Create calls if that does make a difference here.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.