{"record":{"id":"1571a023386d167e","repo":"dotnet/efcore","slug":"the-property-propertytype-structuraltype-pro","errorCode":null,"errorMessage":"The property '{propertyType} {structuralType}.{property}' has element type '{elementType}', which requires a value converter. Elements types requiring value converters are not currently supported with the Azure Cosmos DB database provider.","messagePattern":"The property '(.+?) (.+?)\\.(.+?)' has element type '(.+?)', which requires a value converter\\. Elements types requiring value converters are not currently supported with the Azure Cosmos DB database provider\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Cosmos/Infrastructure/Internal/CosmosModelValidator.cs","lineNumber":713,"sourceCode":"    }\n\n    /// <summary>\n    ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to\n    ///     the same compatibility standards as public APIs. It may be changed or removed without notice in\n    ///     any release. You should only use it directly in your code with extreme caution and knowing that\n    ///     doing so can result in application failures when updating to a new Entity Framework Core release.\n    /// </summary>\n    protected virtual void ValidateElementConverters(\n        IProperty property,\n        ITypeBase structuralType,\n        IDiagnosticsLogger<DbLoggerCategory.Model.Validation> logger)\n    {\n        var typeMapping = property.GetElementType()?.GetTypeMapping();\n        while (typeMapping != null)\n        {\n            if (typeMapping.Converter != null)\n            {\n                throw new InvalidOperationException(\n                    CosmosStrings.ElementWithValueConverter(\n                        property.ClrType.ShortDisplayName(),\n                        structuralType.ShortName(),\n                        property.Name,\n                        typeMapping.ClrType.ShortDisplayName()));\n            }\n\n            typeMapping = typeMapping.ElementTypeMapping;\n        }\n    }\n\n    /// <summary>\n    ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to\n    ///     the same compatibility standards as public APIs. It may be changed or removed without notice in\n    ///     any release. You should only use it directly in your code with extreme caution and knowing that\n    ///     doing so can result in application failures when updating to a new Entity Framework Core release.\n    /// </summary>\n    protected virtual void ValidateConcurrencyToken(","sourceCodeStart":695,"sourceCodeEnd":731,"githubUrl":"https://github.com/dotnet/efcore/blob/dbf9771522148d61a2467854921bd5dc6f6e6916/src/EFCore.Cosmos/Infrastructure/Internal/CosmosModelValidator.cs#L695-L731","documentation":"Thrown by CosmosModelValidator.ValidateElementConverters while walking a property's element-type-mapping chain (typeMapping.ElementTypeMapping loop). Cosmos has no way to serialize element values that need a value converter (e.g. a custom struct element, an enum stored as a non-native type), so any converter in that chain is rejected. The message names the property CLR type, structural type, property name, and the element CLR type that carried the converter.","triggerScenarios":"Declaring a collection property whose element type has a value converter configured, e.g. List<MyEnum> with a non-default enum conversion, or a List<Guid> with a custom converter applied at the element level. Also triggered by owned collections whose elements have converters.","commonSituations":"Reusing a relational model (which supports element converters) against the Cosmos provider. Custom value converters on enums or value objects that are applied globally and therefore also attach to collection elements.","solutions":["Remove the value converter from the element type, or change the element CLR type to a Cosmos-native type (string, int, bool, byte, sbyte, float, double, etc.).","If a custom type is required, project it into a separate owned/entity shape that Cosmos can serialize natively, instead of storing it as a converted array element.","Avoid registering the converter globally; scope it so it does not attach to collection elements."],"exampleFix":"// before\nmodelBuilder.Entity<Order>()\n    .Property(o => o.Tags)\n    .HasConversion(\n        v => string.Join('|', v),\n        v => v.Split('|').ToList());\n\n// after: store the collection as a native List<string> without an element converter\npublic List<string> Tags { get; set; }","handlingStrategy":"validation","validationCode":"// Detect element converters on Cosmos-mapped collections before validation\nforeach (var et in modelBuilder.Model.GetEntityTypes())\n{\n    foreach (var prop in et.GetProperties())\n    {\n        var el = prop.GetElementType();\n        if (el?.GetTypeMapping()?.Converter is not null)\n        {\n            throw new InvalidOperationException($\"Property {et.DisplayName()}.{prop.Name} has an element value converter, unsupported by Cosmos.\");\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid global value converters; scope them so they do not attach to collection elements.","Use native CLR element types (string, int, bool, byte, sbyte, float, double) for collections stored in Cosmos."],"tags":["cosmos","ef-core","model-validation","value-converter","collections"],"analyzedSha":"dbf9771522148d61a2467854921bd5dc6f6e6916","analyzedAt":"2026-08-06T20:46:03.226Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}