Answered

Getting "User Not Found" error when creating a contact

  • 7 November 2023
  • 4 replies
  • 182 views

Hi,

Recently I have been noticing that we have been receiving an error_code of “not_found” when making a POST request to the /contacts endpoint (creating a contact).

This is surprising as I am not sure how this is possible when creating a contact (as opposed to updating one).

If it helps, an example request id for this 000bkte0pcsrns5hpus0, hopefully I am not just off-base but I was looking to understand how this might happen? I am not sure what this error code could mean when trying to create a contact.

icon

Best answer by Jacob Cox 13 November 2023, 00:42

View original

4 replies

Userlevel 4
Badge +5

Hi @Smock !

That is a curious one. I looked through our logs around that request ID and can’t nail down why a 404 would be thrown. I did notice that the User was actually created at the same time that the call occurred. This makes me wonder, were you making 2 identical calls at the same time? Not sure why that would result in a 404 vs a 409 error, but I am seeing a few mentions of ‘duplicates’ in the logs.

Hi Jacob,

Thanks very much for getting back to me.

I was just looking into this - I found some old code of ours that was processing the same event at the same time and so looks to have been causing a race condition that tried to create the contact (which specifically was intended for the kind of user in our system that all the not_found errors seem to be happening for), and was wondering whether the not_found could actually have meant to have been a conflict.

I am in the process of tidying this up so will let you know how I get on with the results.

Hi again @Jacob Cox ,

Took a couple of days to get enough data but that does seem to have resolved the issue.

Would it be possible to have this erroneous error code looked at however? - I would like to update our code to better handle conflicts in general, but this is a bit more awkward when “not found” could also mean conflict in some scenarios.

Userlevel 4
Badge +5

Hi @Smock !

Thanks for looking into that! I’m going to open an issue up with our team about this to make sure we are throwing the right error in these scenarios! Thanks for bringing that to our attention!

Reply