# Error when modifying multiple contacts with single-valued property with null value

**URL:** <https://community.hubspot.com/t/error-when-modifying-multiple-contacts-with-single-valued-property-with-null-value/128150>\
**Category:** APIs & Integrations\
**Tags:** python, developer-tools\
**Created:** [March 18, 2025, 7:26am UTC](https://community.hubspot.com/t/error-when-modifying-multiple-contacts-with-single-valued-property-with-null-value/128150 "2025-03-18T07:26:43Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![JMoleroAlonso](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@JMoleroAlonso](https://community.hubspot.com/u/JMoleroAlonso)\
**Post date:** [March 18, 2025, 7:26am UTC](https://community.hubspot.com/t/error-when-modifying-multiple-contacts-with-single-valued-property-with-null-value/128150/1 "2025-03-18T07:26:43Z")

</div>

Hi!,

I have a property ‘subscription\_\_monthly’ set to have unique values. When from Python I call the function ‘client.crm.contacts.batch\_api.update’ with several contacts with that property with value ‘’ (this is the value to set the property to null) I get the error:

`{"status":"error","message":"Property values were not valid: [{\"isValid\":false,\"message\":\"Values for property \\\"subscription __monthly___ coupon_code2\\\" must be unique. Given 2 updates with value \\\"\\\".\",\"error\":\"CONFLICTING_UNIQUE_VALUE\",\"name\":\"subscription __monthly___ coupon_code2\",\"propertyValue\":\"\",\"portalId\":24095220}]","correlationId":"342a577c-60d1-4a08-bb5d-67b83ccb48b6","errors":[{"message":"Values for property \"subscription __monthly___ coupon_code2\" must be unique. Given 2 updates with value \"\".","code":"CONFLICTING_UNIQUE_VALUE","context":{"propertyName":["subscription __monthly___ coupon_code2"]}}],"category":"VALIDATION_ERROR"}`

```lia-code-sample
[
{'id': 1, 'properties': {'company': 'Power!', 'partner': 'true', 'firstname': 'Abrm', 'phone': None, 'subscription __monthly': '', 'subscription__ monthly ___referral_link': '', 'subscription__ non_monthly': 'SNPRO', 'subscription __non_monthly___ referral_link': 'https://www.test.com?fpr=dpa&coupon=SNPRO', 'user_country': None, 'website': None}},

 {'id': 2, 'properties': {'company': 'rading', 'partner': 'true', 'firstname': 'rading', 'phone': None, 'subscription __monthly': '', 'subscription__ monthly ___referral_link': '', 'subscription__ non_monthly': 'PST', 'subscription __non_monthly___ referral_link': 'https://www.test.com?fpr=dpa&coupon=PST', 'user_country': 'ES', 'website': 'https://www.tradingaldia.com'}}
]

```

The property I am trying to update and having problems with is “subscription\_\_monthly”, which I am sending as

`'subscription__monthly': ""`

If instead of updating in ‘batch’ I update the contacts sequentially (or with batches of size 1), no errors occur.

Is this a bug in the API or is it expected behaviour?

Thank you!

---

<div class="post-metadata">

**Author:** ![kennedyp](https://avatars.discourse-cdn.com/v4/letter/k/49beb7/32.png) [@kennedyp](https://community.hubspot.com/u/kennedyp)\
**Post date:** [March 18, 2025, 9:00pm UTC](https://community.hubspot.com/t/error-when-modifying-multiple-contacts-with-single-valued-property-with-null-value/128150/2 "2025-03-18T21:00:07Z")

</div>

Hi @JMoleroAlonso! Welcome to the Community-- happy to have you here 😊

Can you clarify what field type the subscription\_\_monthly property is? Is this a single-line text?

@SteveHTM notes in a similar thread that enumeration values that have been cleared may return as “” as opposed to “none”: [**Difference between null and “” in contact property value**](https://community.hubspot.com/t5/APIs-Integrations/Difference-between-null-and-quot-quot-in-contact-property-value/m-p/948231#M72141)

I want to invite some subject matter experts to see if they have any suggestions.

Hey @evaldas, @GRajput have you experienced this error with batch upserts? Any troubleshooting advice?

_Best,_

Kennedy

---

<div class="post-metadata">

**Author:** ![evaldas](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/evaldas/32/69160_2.png) [@evaldas](https://community.hubspot.com/u/evaldas)\
**Post date:** [March 18, 2025, 10:50pm UTC](https://community.hubspot.com/t/error-when-modifying-multiple-contacts-with-single-valued-property-with-null-value/128150/3 "2025-03-18T22:50:02Z")

</div>

Hi @JMoleroAlonso,

Looking at the error log you provided, what appears to be happening is that when you use the batch upsert, you have multiple records with the same value that is supposed to be unique.

Specifically, it says:

`Values for property "subscription __monthly___ coupon_code2" must be unique`

The error says property **“subscription\_\_monthly\_\_\_coupon\_code2”** but you mention property **“subscription\_\_monthly”**. So the other thing to check there is which property you actually intend to be the unique one.

Let’s just assume you want the **“subscription\_\_monthly”** to be unique.

Currently your records are:

Record ID 1

```lia-code-sample
'company': 'Power!',
'subscription__monthly': ''

```

Record ID 2

```lia-code-sample
'company': 'rading',
'subscription__monthly': ''

```

So if you are using **“subscription\_\_monthly”** as the unique record, you will receive the error because both records have the same value when the API is expecting unique values there (like an ID cannot be the same for more than one record). It would be the same as if you entered “123” in both records.

That is probably why when you upload in batches of 1, there is no other record to compare to and technically the null value is unique in your batch of 1.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![JMoleroAlonso](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@JMoleroAlonso](https://community.hubspot.com/u/JMoleroAlonso)\
**Post date:** [March 19, 2025, 7:04am UTC](https://community.hubspot.com/t/error-when-modifying-multiple-contacts-with-single-valued-property-with-null-value/128150/4 "2025-03-19T07:04:12Z")

</div>

Hi @evaldas ,

subscription\_\_monthly\_\_\_coupon\_code2 and subscription\_\_monthly. I forgot to rename them in the log.

@kennedyp The field is of type single-text.

In the Python API ‘’ is the value used to remove the value of a property. That is, it is the way to indicate the absence of value. Even if the property has a single value, you can have several objects with the property set to null. The API should accept sending several records with value ‘’ as it is a special value.  
I have tried sending None instead of ‘’ but with None the property is not cleared.

Thank you!

---

<div class="post-metadata">

**Author:** ![evaldas](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/evaldas/32/69160_2.png) [@evaldas](https://community.hubspot.com/u/evaldas)\
**Post date:** [March 19, 2025, 1:13pm UTC](https://community.hubspot.com/t/error-when-modifying-multiple-contacts-with-single-valued-property-with-null-value/128150/5 "2025-03-19T13:13:10Z")

</div>

@JMoleroAlonso - both of the subscription properties you mentioned can have whatever value you need it to have - including blank/null - but they cannot be set as the **idProperty** in the API. Typically the email property is used for that purpose, since two contacts cannot have the same email address.

---

<div class="post-metadata">

**Author:** ![JMoleroAlonso](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@JMoleroAlonso](https://community.hubspot.com/u/JMoleroAlonso)\
**Post date:** [March 25, 2025, 10:30am UTC](https://community.hubspot.com/t/error-when-modifying-multiple-contacts-with-single-valued-property-with-null-value/128150/6 "2025-03-25T10:30:03Z")

</div>

Hi @evaldas

The problem arises when in the BatchInputSimplePublicObjectBatchInput method I send 2 inputs with the same property with value ‘’.

[  
{ ‘id’:‘record1’, ‘subscription\_\_monthly’: ‘’}  
{ ‘id’:‘record2’, ‘subscription\_\_monthly’: ‘’}  
]

The value ‘’ is valid and if I update the registers sequentially there is no problem but if I do it in Batch with BatchInputSimplePublicObjectBatchInput I get the error ‘Values for property “subscription\_\_monthly” must be unique

---

<div class="post-metadata">

**Author:** ![evaldas](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/evaldas/32/69160_2.png) [@evaldas](https://community.hubspot.com/u/evaldas)\
**Post date:** [March 25, 2025, 1:09pm UTC](https://community.hubspot.com/t/error-when-modifying-multiple-contacts-with-single-valued-property-with-null-value/128150/7 "2025-03-25T13:09:49Z")

</div>

Can you share the full API call that you are using?

---

<div class="post-metadata">

**Author:** ![JMoleroAlonso](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@JMoleroAlonso](https://community.hubspot.com/u/JMoleroAlonso)\
**Post date:** [March 25, 2025, 1:52pm UTC](https://community.hubspot.com/t/error-when-modifying-multiple-contacts-with-single-valued-property-with-null-value/128150/8 "2025-03-25T13:52:49Z")

</div>

Hi @evaldas ,

this is the call I perform from Python

```lia-code-sample
batch_input_simple_public_object_batch_input = BatchInputSimplePublicObjectBatchInput(inputs=chuck)
api_response = self.client.crm.contacts.batch_api.update(
 batch_input_simple_public_object_batch_input=batch_input_simple_public_object_batch_input)
response_results: list[SimplePublicObject] = api_response.results

```

The content of “chuck” is:

```lia-code-sample
[{'id': 216006776, 'properties': {'company': 'Power!', 'd_zero_partner': 'true', 'firstname': 'Abraham', 'phone': None, 
'subscription__monthly': '', 'subscription_monthly_referral_link': '', 'subscription_non_monthly_coupon_code': 'PRO', 
'subscription_non_monthly_referral_link': 'https://www.domain.com?fpr=dpwua&coupon=PRO', 'user_country': None, 'website': None}}, 
{'id': 216018862, 'properties': {'company': 'Day', 'd_zero_partner': 'true', 'firstname': 'Day',
 'phone': None, 'subscription__monthly': '', 'subscription_monthly_referral_link': '', 'subscription_non_monthly_coupon_code': 
 'PRE', 'subscription_non_monthly_referral_link': 'https://www.domain.com?fpr=dpwua&coupon=PRE', 'user_country': 'ES',
 'website': 'https://www.day.com'}}]

```

And the error message is:

`HTTP response body: {"status":"error","message":"Property values were not valid: [{\"isValid\":false,\"message\":\"Values for property \\\"subscription __monthly\\\" must be unique. Given 2 updates with value \\\"\\\".\",\"error\":\"CONFLICTING_UNIQUE_VALUE\",\"name\":\"subscription__ monthly\",\"propertyValue\":\"\",\"portalId\":24095220},{\"isValid\":false,\"message\":\"Values for property \\\"subscription_monthly_referral_link\\\" must be unique. Given 2 updates with value \\\"\\\".\",\"error\":\"CONFLICTING_UNIQUE_VALUE\",\"name\":\"subscription_monthly_referral_link\",\"propertyValue\":\"\",\"portalId\":24095220}]","correlationId":"9b10-db2b4ea09b24","errors":[{"message":"Values for property \"subscription__monthly\" must be unique. Given 2 updates with value \"\".","code":"CONFLICTING_UNIQUE_VALUE","context":{"propertyName":["subscription__monthly"]}},{"message":"Values for property \"subscription_monthly_referral_link\" must be unique. Given 2 updates with value \"\".","code":"CONFLICTING_UNIQUE_VALUE","context":{"propertyName":["subscription_monthly_referral_link"]}}],"category":"VALIDATION_ERROR"}`

The field “subscription\_\_monthly” is set as “unique value”

thank you!

---

<div class="post-metadata">

**Author:** ![evaldas](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/evaldas/32/69160_2.png) [@evaldas](https://community.hubspot.com/u/evaldas)\
**Post date:** [March 25, 2025, 2:28pm UTC](https://community.hubspot.com/t/error-when-modifying-multiple-contacts-with-single-valued-property-with-null-value/128150/9 "2025-03-25T14:28:11Z")

</div>

Hi @JMoleroAlonso,

As I had mentioned in previous messages, you cannot set the field as “unique value” if there is a change that field values will be the same.

To illustrate, this is NOT unique because values for “subscription\_\_monthly” are identical:

```lia-code-sample
{ ‘id’:‘record1’, ‘subscription__monthly’: ''}
{ ‘id’:‘record2’, ‘subscription__monthly’: ''}

```

To resolve this issue you have two options:

**Option A:** Change your unique value to a field that will ALWAYS have unique values, such as “id” or “email” - **this will allow passing null values in “subscription\_\_monthly” field**

**Option B:** If you are required to have “subscription\_\_monthly” as the unique value, make sure your “subscription\_\_monthly” field always has unique values. Example of option B:

```lia-code-sample
{ ‘id’:‘record1’, ‘subscription__monthly’: 'null_1'}
{ ‘id’:‘record2’, ‘subscription__monthly’: 'null_2'}

```
