Error Library / AEP

XDM error: field "expected type object but got string" (ECID, identityMap)

What you seeField 'ecid' expected type 'object' but got 'string'

The schema defines the field as an object (a group of sub-fields) but the file sends a single text value. Identity fields are the classic case: an ECID sent as a flat string where the schema expects the identity structure.

Why it happens

  • In XDM, identities are usually carried in identityMap: a map from namespace (ECID, Email, CRMID…) to a list of objects, each with an id and optional primary and authenticatedState properties.
  • A CSV export has one column per value, so an ECID arrives as a plain string like "8127364…". Placing that string directly where the schema expects the object shape is a type mismatch.
  • The same error appears for any object field (for example commerce.order) that receives a scalar.

How to fix it

  1. Check the schema tree: if the target is an object, map the value to the right sub-field instead of the object itself.
  2. For ECID, map the column into identityMap under the ECID namespace, e.g. identityMap.ECID[0].id, and set primary to true if it is the primary identity.
  3. Alternatively, add a dedicated identity field (a string field marked as an identity) to the schema and map the column to that.
  4. Re-ingest a small batch and preview a record to confirm the nested shape.

Before and after

Fails
{ "ecid": "81273645918273645" }
Works
{ "identityMap": { "ECID": [ { "id": "81273645918273645", "primary": true } ] } }

Common questions

Should ECID be the primary identity?

For anonymous web and app events it usually is. For records that always carry a login or CRM id, that id is often the better primary identity.

Why does the error name a field that is in my schema?

The field exists, but with a different type. The message is about the shape of the value, not a missing field.

Practise the fix

Resolve Identities Across Sources

Reproduce this error in your own AEP practice workspace, fix it, and earn a verifiable credential for the skills involved: Custom identity namespaces, Merge policies, Cross-source identity resolution, Merged profile validation.

Related errors

AdsBot is an independent training provider, not affiliated with Adobe. Behaviour can differ between ingestion methods and product versions; always test with a small batch first.