MetricSign
EN|NLRequest Access
Medium severitydata source

Power BI Refresh Error:
DF-Cosmos-InvalidPartitionKeyContent

What does this error mean?

The ADF Mapping Data Flow Cosmos DB sink found a partition key value in the incoming data that violates Cosmos DB's partition key content rules — such as a value that exceeds the 2 KB size limit, is of an unsupported type, or is empty.

Common causes

  • 1One or more rows contain a partition key value that is null, empty, or exceeds 2 KB in size — Cosmos DB enforces a strict 2 KB limit on partition key values
  • 2The partition key column contains an unsupported data type (e.g., array or object) rather than a scalar value (string, number, or boolean)
  • 3An upstream transformation produces partition key values with leading/trailing whitespace or special characters that Cosmos DB rejects

How to fix it

  1. 1Enable data flow Debug mode and preview the Cosmos DB sink input — filter to rows where the partition key column is null, empty, or suspiciously long.
  2. 2Add a Filter transformation to exclude rows with null or empty partition key values before they reach the sink.
  3. 3Add a Derived Column transformation to trim, truncate, or normalize the partition key value if it contains whitespace or exceeds size limits.
  4. 4Confirm the partition key column data type is string, integer, or boolean — if it's an object or array, extract the scalar property you intend to use as the key.

Frequently asked questions

What are valid partition key value types in Cosmos DB?

Cosmos DB accepts strings, numbers, and booleans as partition key values — arrays and objects are not valid. Values must also be 2 KB or smaller.

Can null partition key values be allowed in any Cosmos DB configuration?

No — every Cosmos DB document must have a non-null value for the partition key property. Documents without a valid partition key are rejected.

Does this error affect all rows or the rows with invalid values?

The entire data flow fails — bad rows are not skipped. Use a Filter transformation to exclude invalid partition key values before the sink.

Official documentation: https://learn.microsoft.com/en-us/azure/data-factory/data-flow-troubleshoot-guide

Other data source errors