Duplicate call to addWithDupCheck detected


(Caleb Tucker-Raymond) #1

I’m getting an exception, “Duplicate call to addWithDupCheck detected” in an application that creates and updates Contact records.

For what it’s worth, I’m using the Novak Solutions SDK, so XML-RPC, but I see someone else’s issue on github wondering about the same error on the infusionsoft-php library (https://github.com/infusionsoft/infusionsoft-php/issues/108) - and so that makes me think it is an Infusionsoft issue and I am posting here instead of the issue queue for the library.

What I expect to happen is for the addWithDupCheck to return a contact ID if the contact already exists. As far as I know, this was the behavior until about two weeks ago.

I reviewed the API documentation for this method and can’t find anything regarding duplicate calls.

Is it a bug, or expected behavior? If it is not a bug, I’d like learn more about when addWithDupCheck is allowed and when it is not.

Great job on the new forums, I am glad to have them back.


(John Borelli) #2

Hi @calebtr,

So the addWithDupCheck method has a 5 second repeat warning that you’ve described. You can run tests that are separated by 10 seconds and should not get a message but if you call back to back then you should. Specifically with the Novak implementation, I know that if an error is detected in the call then it retries the call so if a “glitch” in that mechanism is happening then it could be possible for it to come across as a duplicate call message.


(Caleb Tucker-Raymond) #3

That explains it perfectly - am I right that this is undocumented?

For the number of errors I’m seeing, it sounds like I need to do a better job de-duping the data myself.


(John Borelli) #4

First, it seems the 5 seconds is wrong according to @MichaelFairchild (who definitely would know). It’s 5 minutes.

It is not in any documentation that I’ve seen (except maybe on Novaksolutions.com where they have an “api gotcha” page.

I personally keep a log or database transaction record to manage this but you can also just check for the error message and respond gracefully.


(Shauna Cannon) #5

I just implemented a simple try/catch/finally to catch all Exceptions returned and handled it accordingly. This seems to have solved the issue for us…

if ($infusionsoft->getToken()) {
	try {
		$contact = array('FirstName' => 'John', 'LastName' => 'Doe', 'Email' => 'johndoe@mailinator.com');
		$cid = $infusionsoft->contacts->addWithDupCheck($contact, 'Email');
	}
	catch (Exception $e) {
		if (!$cid || $e instanceof \Infusionsoft\TokenExpiredException) {
			$infusionsoft->refreshAccessToken();
			$token = serialize($infusionsoft->getToken());
		}
	}
	finally {
		if( serialize($infusionsoft->getToken()) ) {
			$_SESSION['token'] = serialize($infusionsoft->getToken());
		}
		else {
			echo '<a href="' . $infusionsoft->getAuthorizationUrl() . '">Click here to authorize</a>';
		}
	}
}
else {
	echo '<a href="' . $infusionsoft->getAuthorizationUrl() . '">Click here to authorize</a>';
}

(Jon Smith) #6

If you would like to receive an email notification when we have resolved the issue please navigate to the known issues page (http://knownissues.infusionsoft.com/) Find “ContactService.addWithDupChecking isn’t allowing duplicate checking to be done within a set amount of time” and choose “Report this issue for your app”. Fill out the form and you will be notified when this issue is resolved.