Hi,
We are migrating our codebase to Abp V14.2.0. While testing user login, for failed login attempts, we are getting the error below. PFA screenshot.
"SqlException: Invalid column name 'FailReason'."
I checked, and the table(AbpUserLoginAttempts) is updated with the new column.
SQL table(AbpUserLoginAttempts) columns after db migration :
logs.txt:
System.Threading.Tasks.Task1[Microsoft.AspNetCore.Mvc.IActionResult] Login(Glex.Web.Models.Ui.LoginModel, System.String) on controller Glex.Web.Controllers.UiController (Glex.Web.Host). ERROR 2025-09-18 21:26:13,602 [5 ] oft.EntityFrameworkCore.Database.Command - Failed executing DbCommand (61ms) [Parameters=[@p0='?' (Size = 512), @p1='?' (Size = 64), @p2='?' (Size = 128), @p3='?' (DbType = DateTime2), @p4='?' (Size = 1024), @p5='?' (Size = 1) (DbType = Byte), @p6='?' (Size = 64), @p7='?' (DbType = Int32), @p8='?' (DbType = Int64), @p9='?' (Size = 256)], CommandType='Text', CommandTimeout='30'] SET IMPLICIT_TRANSACTIONS OFF; SET NOCOUNT ON; INSERT INTO [AbpUserLoginAttempts] ([BrowserInfo], [ClientIpAddress], [ClientName], [CreationTime], [FailReason], [Result], [TenancyName], [TenantId], [UserId], [UserNameOrEmailAddress]) OUTPUT INSERTED.[Id] VALUES (@p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9); ERROR 2025-09-18 21:26:13,714 [5 ] Microsoft.EntityFrameworkCore.Update - An exception occurred in the database while saving changes for context type 'Glex.EntityFrameworkCore.GlexDbContext'. Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details. ---> Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid column name 'FailReason'. at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__211_0(Task1 result)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
Please advise.!
1 Answer(s)
-
0
Hi @Anshu
Thanks for reporting this. From the error and the screenshot, it looks like your database schema is already updated with the new FailReason column. However, the error "Invalid column name 'FailReason'" usually indicates that the migration hasn’t been fully applied on the database your application is actually connecting to.
A few things to double check:
Correct Database in Use Ensure that the connection string used by your application points to the same database where you verified the
AbpUserLoginAttemptstable contains theFailReasoncolumn.Pending Migrations Run
Update-Databaseor the equivalent command to make sure all migrations are applied to the target DB. Sometimes the local/dev DB gets updated, but staging/production may be lagging behind.Column Cache If you are sure the DB schema is correct, try restarting the application and clearing any cached EF metadata (sometimes EF can still be holding onto an outdated schema).
Make sure you don't override the database connection string in
secrets.json. It will be one level aboveappsettings.jsonand will ignore any sub values.Most likely the issue is that your app is connecting to a different DB than the one you checked. Please verify the connection string and migrations once more.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)