PartitionKey extracted from document doesn't match the one specified in the header

Swathi 6 Reputation points
2021-08-29T15:38:19+00:00

I created new container and given partition key as zone.
127328-image.png

I can't add new item, I am facing following error,

127374-image.png

Message: {"Errors":["PartitionKey extracted from document doesn't match the one specified in the header. Learn more: https://aka.ms/CosmosDB/sql/errors/wrong-pk-value"]} ActivityId: 1bd747bb-29de-4067-bab7-45994968e717, Request URI: /apps/c0759384-3173-4bae-9da1-e9adc88a7791/services/3cb63744-5ee3-456c-af65-bb8bece3a0d6/partitions/ea676d97-7ab5-488b-99e6-ed9520b49f8e/replicas/132745797013276843p, RequestStats: RequestStartTime: 2021-08-29T15:37:23.4498781Z, RequestEndTime: 2021-08-29T15:37:23.4598757Z, Number of regions attempted:1 ResponseTime: 2021-08-29T15:37:23.4598757Z, StoreResult: StorePhysicalAddress: rntbd://10.28.95.165:11448/apps/c0759384-3173-4bae-9da1-e9adc88a7791/services/3cb63744-5ee3-456c-af65-bb8bece3a0d6/partitions/ea676d97-7ab5-488b-99e6-ed9520b49f8e/replicas/132745797013276843p, LSN: 19, GlobalCommittedLsn: 19, PartitionKeyRangeId: 0, IsValid: True, StatusCode: 400, SubStatusCode: 1001, RequestCharge: 1.24, ItemLSN: -1, SessionToken: -1#19, UsingLocalLSN: False, TransportException: null, BELatencyMs: 0.486, ActivityId: 1bd747bb-29de-4067-bab7-45994968e717, ResourceType: Document, OperationType: Create , SDK: Microsoft.Azure.Documents.Common/2.14.0

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
2,944 questions
Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,543 questions
{count} vote

3 answers

Sort by: Most helpful
  1. Privileged - Nehme Gadaoun 11 Reputation points
    2021-09-29T16:09:07.163+00:00

    The answer above is not correct, I think there's a bug in the UI and no one has addressed it...

    2 people found this answer helpful.

  2. Franklin Dilan Maturana Cogollo 5 Reputation points
    2023-07-09T20:22:59.1433333+00:00

    I have encountered the same issue, and I have discovered that if you enable the 'Automatic' option in indexing, it can cause the addition of certain items to fail. Therefore, I opted to turn off the 'Automatic' option, and it resolved the problem for me

    1 person found this answer helpful.
    0 comments No comments

  3. Santhosh Kumar Dhanasekaran 1 Reputation point
    2021-08-30T07:52:57.15+00:00

    @Swathi When creating a new container make sure use use "/" before the key name. For your case, it should be /zone
    Hope this helps.

    0 comments No comments