Following two queries don't work for me:

SELECT count() from OauthToken
SELECT count() from ThirdPartyAccountLink

I get the following:

UNKNOWN ERROR: UNKNOWN_EXCEPTION: An unexpected error occurred. Please include this ErrorId if you contact support:

I couldn't find anything in the documentation related to this. I'm aware that some sObjects require certain fields being included in the query, but in all such cases I got an error saying that.

Any hints on this one?

Thanks in advance!

2 Answers 2


It sounds like you have received a "GAC" i.e. an internal server error from Salesforce which gives an errorId that is a long sequence of numbers.

You should reach out to Salesforce support and provide them this errorId as part of the case to help them debug the underlying issue and resolve the problem.

From what I understand OAuthToken is a virtual SObject and as such it probably doesn't support the Aggregate queries as the Id is always null and I believe Count() and Count(Id) are equivalent hence why you are likely getting the error.


When I tried select count(id) from OAuthToken in developer console I got a message:

enter image description here

As @pbattisson states, some objects don't have this functionality (yet).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .