EF Core: The LINQ expression 'x' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly
The query uses C# code EF Core can’t convert to SQL — custom methods, unsupported string/date functions, or complex projections.
Seen on:
.NET
Meaning
EF Core 3+ throws instead of silently evaluating on the client. Rewrite with translatable operations, move the custom part after AsEnumerable(), or use EF.Functions.
Common causes
- Calling your own methods inside Where/Select
- Unsupported string comparisons (StringComparison) or formatting
- GroupBy shapes EF can’t translate
⚡ Quick fix
- Rewrite using translatable expressions (EF.Functions.Like, simple comparisons)
- Filter in SQL first, then AsEnumerable() for client-side parts
- Use raw SQL for complex queries
Detailed fix by platform
C#
- csharp
var rows = await db.Users .Where(u => EF.Functions.Like(u.Email, "%@example.com")) .ToListAsync(); var view = rows.Select(u => Format(u)); // client-side after materialising
How to diagnose
- Expression — Part named in the message
- Version — EF Core version (translation support grows)
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- A second operation was started on this context EF Core: A second operation was started on this context instance before a previous operation completed
- Cannot access a disposed context instance ObjectDisposedException: Cannot access a disposed context instance
- cannot be tracked because another instance with the same key The instance of entity type 'X' cannot be tracked because another instance with the same key value for {'Id'} is already being tracked
Most viewed in .NET
- NullReferenceException System.NullReferenceException: Object reference not set to an instance of an object
- FileNotFoundException assembly Could not load file or assembly 'X, Version=…' or one of its dependencies
- InvalidOperationException InvalidOperationException: Unable to resolve service for type 'X' while attempting to activate 'Y'
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026