dotnet/efcore · error · InvalidOperationException
Property ' . ' was configured for full-text search, but has…
Error message
Property '{entityType}.{property}' was configured for full-text search, but has type '{clrType}'; only string properties can be configured for full-text search. What it means
CosmosClientWrapper throws FullTextSearchConfiguredForUnsupportedPropertyType when generating full-text paths and finds a property configured for full-text search whose ClrType is not string. Cosmos DB full-text search supports only string properties; applying it to any other CLR type is rejected at create-container time.
Solutions
- Move the full-text configuration to a string property.
- Change the property's CLR type to string if full-text search is required on that data.
- Serialize the searchable content into a dedicated string column and index that.
Example fix
// before - Content is byte[] modelBuilder.Entity<Doc>().Property(x => x.Content).IsFullText(); // after - Text is string and holds searchable content modelBuilder.Entity<Doc>().Property(x => x.Text).IsFullText();
Defensive patterns
Strategy: validation
Validate before calling
// At model build, assert full-text-configured properties are strings.
foreach (var prop in entityType.GetProperties())
{
if (prop.IsFullText() == true && prop.ClrType != typeof(string))
throw new InvalidOperationException($"{entityType.DisplayName()}.{prop.Name} ({prop.ClrType.Name}) cannot be full-text indexed; only string is supported.");
} Type guard
static bool CanBeFullTextIndexed(IProperty p) => p.ClrType == typeof(string);
Prevention
- Apply full-text configuration only to string properties.
- Add a model-build validator that rejects full-text on non-string properties.
- Store searchable content in a dedicated string column when the source is non-string.
When it happens
Trigger: Marking a non-string property (int, byte[], Json, GUID, etc.) as full-text searchable in OnModelCreating.
Common situations: Accidentally applying IsFullText to a binary/JSON payload column; applying full-text configuration to the wrong property; copy-paste from a string property to a non-string one.
Related errors
- A full-text index on
- The 'VectorDistance' function can only be used with a…
- A full-text index is defined for
- A full-text index on
- A vector index on ' ' is defined over properties ` `. A…
AI-assisted analysis of dotnet/efcore@3a2006ef56 (2026-08-11).
Data as JSON: /api/errors/d4f50b014f9f6353.
Report an issue: GitHub.
Appendix: source
Thrown at src/EFCore.Cosmos/Storage/Internal/CosmosClientWrapper.cs:250
? CompositePathSortOrder.Descending
: CompositePathSortOrder.Ascending;
compositePaths.Add(new CompositePath { Path = path, Order = order });
key.Append(path).Append('=').Append(order).Append('|');
}
if (seenCompositeIndexes.Add(key.ToString()))
{
compositeIndexes.Add(compositePaths);
}
}
}
var fullTextPaths = new Collection<FullTextPath>();
foreach (var (property, language) in parameters.FullTextProperties)
{
if (property.ClrType != typeof(string))
{
throw new InvalidOperationException(
CosmosStrings.FullTextSearchConfiguredForUnsupportedPropertyType(
property.DeclaringType.DisplayName(),
property.Name,
property.ClrType.Name));
}
fullTextPaths.Add(
new FullTextPath
{
Path = GetJsonPropertyPathFromRoot(property),
// TODO: remove the fallback once Cosmos SDK allows optional language (see #35939)
Language = language ?? parameters.DefaultFullTextLanguage ?? "en-US"
});
}
var embeddings = new Collection<Embedding>();
foreach (var (property, vectorType) in parameters.Vectors)
{View on GitHub (pinned to 3a2006ef56)