+ Start a Discussion
Kristen Aldrich 14Kristen Aldrich 14 

Error System.QueryException Duplicate fields selected

I received 100+ error emails overnight that all look a bit like what I've copied/pasted below. I'm not a developer and am trying to figure out how to fix this. Luckily it's in our Partial Sandbox, so is not affecting our Production org but still, would like to get to the bottom of it. From what I've read, a duplicate field error like this means there are fields with identical API names and the query errors out essentially not knowing which one to use/reference. I do see fields with the label "Amount" with identical APIs but nothing that has changed or been added in the last couple days, which makes me think why would this error suddenly come up now. Where do I find the query? How do I identify which Amount field it's looking for? And where/how do I update the query to fix this?

Error Type: System.QueryException
Error Date: 2019-12-13 04:15:20
Message: "npsp__Largest_Soft_Credit_Date__c,npo02__LastOppAmount__c,npo02__LastCloseDate__c,npo02__LastMembershipAmount__c
^
ERROR at Row:1:Column:350
duplicate field selected: Amount

Rollups State:"
Context: CRLP.ContactSoftCredit

Stack Trace:
No stacktrace available at the time of saving the record. (npsp)
Foram Rana RForam Rana R
Hi Kristen,

You got this error bcs : two fields have the same API name
Example :

Account obj  = [Select Id, Name, Name from Account];
Here Name  field is used twice then also we are getting two fields have the same API name Error.
Check your select query and let me know your review.
Mark it as best answer if you resolved it.

Thanks,
Foram Rana

 
Kristen Aldrich 14Kristen Aldrich 14
Thanks Foram. Where can I find the select query to edit it?
Foram Rana RForam Rana R
In your apex class related to your functionality.
there is twice the Amount field in your select query.
Kristen Aldrich 14Kristen Aldrich 14
Thanks Foram. The apex class is from a managed package, and when I look at it the code area is blank. How should I address that? 
Shraddha D GuptaShraddha D Gupta
Hi Kristen,

Were you able to resolve this issue?

I am also getting similar issue as below-

SBQQ.OpportunityAfter: execution of AfterUpdate caused by: System.QueryException : duplicate field selected: SBQQ__Status__c(SBQQ) No record updated

and not sure how to resolve this. 

Any help would be much appreaciated. 

Thanks!
Kristen Aldrich 14Kristen Aldrich 14
Hi Shraddha,
I never got an answer or resolution but the issue hasn't come up again since December 2019.
Shraddha D GuptaShraddha D Gupta
Hi Kristen,

Oh okay.. great it is. 

But in our case we are getting error a lot in sandbox environment. 

Thanks!