CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Database Error Code: Duplicate entry '0-1' for key 2, 1062
Pages: [1]

Author Topic: Database Error Code: Duplicate entry '0-1' for key 2, 1062  (Read 7903 times)

joommaster

  • Guest
Database Error Code: Duplicate entry '0-1' for key 2, 1062
June 23, 2007, 09:35:33 am
I am getting this error when I do a test contribution. The contribution goes through fine but we get this page after we click "make contribution":

Sorry. A non-recoverable error has occurred.

Database Error Code: Duplicate entry '0-1' for key 2, 1062

Return to CiviCRM menu.

Error Details:


Array
(
    [callback] => Array
        (
           
  • => CRM_Core_Error
  • [1] => handle
            )

       
Code: [Select]
=> -5
    [message] => DB Error: already exists
    [mode] => 16
    [debug_info] => INSERT INTO civicrm_contribution (domain_id , contact_id , contribution_type_id , contribution_page_id , payment_instrument_id , receive_date , non_deductible_amount , total_amount , fee_amount , net_amount , trxn_id , invoice_id , currency , receipt_date , source , amount_level , contribution_status_id ) VALUES ( 1 ,  18 ,  2 ,  1 ,  1 ,  20070623114122 ,  1.00 ,  1.00 ,  NULL ,  1.00 , '0' , 'b6c6fbe3df3c098fe2e67f07235067b4' , 'USD' ,  20070623114122 , 'Online Contribution' ,  NULL ,  1 )  [nativecode=1062 ** Duplicate entry '0-1' for key 2]
    [type] => DB_Error
    [user_info] => INSERT INTO civicrm_contribution (domain_id , contact_id , contribution_type_id , contribution_page_id , payment_instrument_id , receive_date , non_deductible_amount , total_amount , fee_amount , net_amount , trxn_id , invoice_id , currency , receipt_date , source , amount_level , contribution_status_id ) VALUES ( 1 ,  18 ,  2 ,  1 ,  1 ,  20070623114122 ,  1.00 ,  1.00 ,  NULL ,  1.00 , '0' , 'b6c6fbe3df3c098fe2e67f07235067b4' , 'USD' ,  20070623114122 , 'Online Contribution' ,  NULL ,  1 )  [nativecode=1062 ** Duplicate entry '0-1' for key 2]
    [to_string] => [db_error: message="DB Error: already exists" code=-5 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_contribution (domain_id , contact_id , contribution_type_id , contribution_page_id , payment_instrument_id , receive_date , non_deductible_amount , total_amount , fee_amount , net_amount , trxn_id , invoice_id , currency , receipt_date , source , amount_level , contribution_status_id ) VALUES ( 1 ,  18 ,  2 ,  1 ,  1 ,  20070623114122 ,  1.00 ,  1.00 ,  NULL ,  1.00 , '0' , 'b6c6fbe3df3c098fe2e67f07235067b4' , 'USD' ,  20070623114122 , 'Online Contribution',  NULL ,  1 )  [nativecode=1062 ** Duplicate entry '0-1' for key 2]"]
)

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Database Error Code: Duplicate entry '0-1' for key 2, 1062
June 23, 2007, 06:55:11 pm
Pretty sure the error is happening because (for some reason) the trxn_id value is '0'  on the insert. This is unexpected - there is a unique key on domain + trxn_id in the DB so we expect a unique value (from the payment processor). What processor are you using?
Protect your investment in CiviCRM by  becoming a Member!

joommaster

  • Guest
Re: Database Error Code: Duplicate entry '0-1' for key 2, 1062
June 24, 2007, 07:53:35 pm
We are using Authorize.net.

idealso

  • Guest
Re: Database Error Code: Duplicate entry '0-1' for key 2, 1062
June 25, 2007, 07:34:03 pm
In test mode, Authorize.Net returns a transaction ID of 0.  CiviCRM therefore is supposed to ignore the returned transaction id of 0, and instead generate a transaction id of "testX".  Which version of CiviCRM are you using?

Jerry

  • Guest
Re: Database Error Code: Duplicate entry '0-1' for key 2, 1062
June 26, 2007, 08:30:37 am
I have experienced the same issue but have found it only shows up when the same individual registers for the same event twice.

Andy Laken

  • I’m new here
  • *
  • Posts: 27
  • Karma: 3
Re: Database Error Code: Duplicate entry '0-1' for key 2, 1062
June 26, 2007, 03:44:09 pm
I was getting the same error a few days ago when attempting to set up Authorize.net for test transactions. I'm using 1.7 and it says "CiviCRM 9753" at the bottom of every page.
Andy Laken
Engineer | CivicActions, LLC
e: andy.laken@civicactions.com | skype: mcantsin | http://twitter.com/alaken

senojeel

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 1
Re: Database Error Code: Duplicate entry '0-1' for key 2, 1062
August 01, 2007, 08:42:21 am
Just curious,

Was there ever a resolution to this post?

Shawn

idealso

  • Guest
Re: Database Error Code: Duplicate entry '0-1' for key 2, 1062
August 01, 2007, 11:50:52 am
This should be fixed.  In 1.8, the generation of the test id is also improved.  I think it may still possible to get a duplicate (usually test10) in 1.7.

senojeel

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 1
Re: Database Error Code: Duplicate entry '0-1' for key 2, 1062
August 02, 2007, 06:59:07 am
I am using a build of 1.8 from last week and I was still getting the error.  I am updating to today's release and will report back.

idealso

  • Guest
Re: Database Error Code: Duplicate entry '0-1' for key 2, 1062
August 02, 2007, 11:55:13 pm
When you do a test transaction, is that with Authorize.Net in test mode, and/or from a CiviCRM test page?

If it's from a CiviCRM test page, then the trxn_id of 0 is replaced with a test number.  If it's from a live page with Authorize.Net in test mode, then CiviCRM does not check for this, and trusts the number returned from Authorize.Net.  Since the response fields don't give any indication of if it was a test request or not, probably the only thing to really do is to check for trxn_id is 0 in live mode, and if so, display an error.  The error message would ask if you meant to submit the transaction as a test.


Laryn

  • I post frequently
  • ***
  • Posts: 192
  • Karma: 4
    • CEDC
  • CiviCRM version: 4.6.x
  • CMS version: Drupal 7
Re: Database Error Code: Duplicate entry '0-1' for key 2, 1062
November 06, 2007, 02:32:59 pm
I am getting the same error with Authorize.net when I've turned the Authorize.net account to Test Mode. Using the live page link from CiviCRM and have upgraded earlier today to 1.9.

Do I read correctly that this is just a test mode problem ... and so if I turn it live it'll work? I'll probably test this tomorrow, but if anyone's already done it I'd love to know beforehand.

Peace,
Laryn
CEDC...social justice by design

*Get support on the new CiviCRM help site. /laryn

Laryn

  • I post frequently
  • ***
  • Posts: 192
  • Karma: 4
    • CEDC
  • CiviCRM version: 4.6.x
  • CMS version: Drupal 7
Re: Database Error Code: Duplicate entry '0-1' for key 2, 1062
November 07, 2007, 12:31:17 pm
Okay, I've turned the account to live mode, and now the error is as follows:

Quote
Sorry. A non-recoverable error has occurred.
Error Details:

Array
(
    [callback] => Array
        (
            [ 0] => CRM_Core_Error
            [ 1] => handle
        )

    [ code] =>
    [message] => Invalid response code received from server
    [mode] => 16
    [debug_info] =>
    [type] => PEAR_Error
    [user_info] =>
    [to_string] => [pear_error: message="Invalid response code received from server" code=0 mode=callback callback=CRM_Core_Error::handle prefix="" info=""]
)

Anyone have advice?
Peace,
Laryn
CEDC...social justice by design

*Get support on the new CiviCRM help site. /laryn

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Database Error Code: Duplicate entry '0-1' for key 2, 1062
November 07, 2007, 02:25:16 pm
That error usually indicates a problem with your outbound mail (SMTP) configuration - AND happens at the end of a contribution sequence because CiviContribute is trying to mail out the receipt to the donor.

Try using "Send Email to a Contact" from a contact summary page - and see if you get the same error. If so, check your Global Settings >> SMTP Settings and search on this forum for that error message for solutions.
Protect your investment in CiviCRM by  becoming a Member!

Laryn

  • I post frequently
  • ***
  • Posts: 192
  • Karma: 4
    • CEDC
  • CiviCRM version: 4.6.x
  • CMS version: Drupal 7
Re: Database Error Code: Duplicate entry '0-1' for key 2, 1062
November 08, 2007, 09:39:23 am
Quote
That error usually indicates a problem with your outbound mail (SMTP) configuration

Bingo! Thanks for that... I think we're up and running now with the ability to take a donation/payment online.
CEDC...social justice by design

*Get support on the new CiviCRM help site. /laryn

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Database Error Code: Duplicate entry '0-1' for key 2, 1062
January 17, 2008, 06:16:41 am
There was another issue related to Authorize.Net.
Please check http://issues.civicrm.org/jira/browse/CRM-2566

kurund
Found this reply helpful? Support CiviCRM

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Database Error Code: Duplicate entry '0-1' for key 2, 1062

This forum was archived on 2017-11-26.