{"timestamp": "2026-06-21 17:17:03.645", "level": "Error", "severity": "ERROR", "requestId": "", "httpMethod": "", "requestUrl": "", "message": "Unhandled Exception in Web API", "stackTrace": "System.InvalidOperationException: The given header was not found.
   at System.Net.Http.Headers.HttpHeaders.GetValues(String name)
   at IncidentReporter.API.Handlers.AcmAuthorise.GetToken(HttpActionContext actionContext) in D:\work\oqsha2\incident-reporter-api\IncidentReporter\IncidentReporter.API\Handlers\AcmAuthorise.cs:line 214
   at IncidentReporter.API.Handlers.AcmAuthorise.OnActionExecuting(HttpActionContext actionContext) in D:\work\oqsha2\incident-reporter-api\IncidentReporter\IncidentReporter.API\Handlers\AcmAuthorise.cs:line 37
   at System.Web.Http.Filters.ActionFilterAttribute.OnActionExecutingAsync(HttpActionContext actionContext, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()"}
{"timestamp": "2026-06-21 17:44:19.815", "level": "Error", "severity": "ERROR", "requestId": "", "httpMethod": "", "requestUrl": "", "message": "Failed to send audit log: Unauthorized
Request Payload: {"EntityTypeId":6,"EntityId":401,"ChangedBy":{"UserId":267,"Name":"Sal Eaton"},"ChangeType":"Created","OldValue":null,"NewValue":{"Uid":"M/KURA/FD2/TM1/26/00002","SiteName":"Carson Valley","Location":"dhsh","CategoryName":"Test Moc 1","DepartmentName":"Admin","MocStatusName":"Submit","InitiatedByName":"Sal Eaton","Description":"xndn","Approvers":"Derek Cope (Admin)","DueDate":null}}
API Response: ", "stackTrace": ""}
{"timestamp": "2026-06-21 19:55:14.454", "level": "Error", "severity": "ERROR", "requestId": "", "httpMethod": "", "requestUrl": "", "message": "Failed to send audit log: Unauthorized
Request Payload: {"EntityTypeId":17,"EntityId":267,"ChangedBy":{"UserId":678,"Name":"Giselle Angle"},"ChangeType":"Updated","OldValue":{"Sites":"Beaverdam","DepartmentName":"Power Plant - 1","Location":""},"NewValue":{"Sites":"Beaverdam","DepartmentName":"Power Plant 1","Location":""}}
API Response: ", "stackTrace": ""}
{"timestamp": "2026-06-21 19:55:25.555", "level": "Error", "severity": "ERROR", "requestId": "", "httpMethod": "", "requestUrl": "", "message": "Failed to send audit log: Unauthorized
Request Payload: {"EntityTypeId":17,"EntityId":268,"ChangedBy":{"UserId":678,"Name":"Giselle Angle"},"ChangeType":"Updated","OldValue":{"Sites":"Beaverdam","DepartmentName":"Power Plant - 2","Location":""},"NewValue":{"Sites":"Beaverdam","DepartmentName":"Power Plant 2","Location":""}}
API Response: ", "stackTrace": ""}
{"timestamp": "2026-06-21 19:55:39.111", "level": "Error", "severity": "ERROR", "requestId": "", "httpMethod": "", "requestUrl": "", "message": "Failed to send audit log: Unauthorized
Request Payload: {"EntityTypeId":17,"EntityId":269,"ChangedBy":{"UserId":678,"Name":"Giselle Angle"},"ChangeType":"Updated","OldValue":{"Sites":"Beaverdam","DepartmentName":"Power Plant - 3","Location":""},"NewValue":{"Sites":"Beaverdam","DepartmentName":"Power Plant 3","Location":""}}
API Response: ", "stackTrace": ""}
{"timestamp": "2026-06-21 19:55:47.330", "level": "Error", "severity": "ERROR", "requestId": "", "httpMethod": "", "requestUrl": "", "message": "Failed to send audit log: Unauthorized
Request Payload: {"EntityTypeId":17,"EntityId":270,"ChangedBy":{"UserId":678,"Name":"Giselle Angle"},"ChangeType":"Updated","OldValue":{"Sites":"Beaverdam","DepartmentName":"Power Plant - 4","Location":""},"NewValue":{"Sites":"Beaverdam","DepartmentName":"Power Plant 4","Location":""}}
API Response: ", "stackTrace": ""}
{"timestamp": "2026-06-21 19:55:55.857", "level": "Error", "severity": "ERROR", "requestId": "", "httpMethod": "", "requestUrl": "", "message": "Failed to send audit log: Unauthorized
Request Payload: {"EntityTypeId":17,"EntityId":271,"ChangedBy":{"UserId":678,"Name":"Giselle Angle"},"ChangeType":"Updated","OldValue":{"Sites":"Beaverdam","DepartmentName":"Power Plant - 5","Location":""},"NewValue":{"Sites":"Beaverdam","DepartmentName":"Power Plant 5","Location":""}}
API Response: ", "stackTrace": ""}
{"timestamp": "2026-06-21 19:56:12.328", "level": "Error", "severity": "ERROR", "requestId": "", "httpMethod": "", "requestUrl": "", "message": "Failed to send audit log: Unauthorized
Request Payload: {"EntityTypeId":17,"EntityId":281,"ChangedBy":{"UserId":678,"Name":"Giselle Angle"},"ChangeType":"Updated","OldValue":{"Sites":"Champion Heights","DepartmentName":"SMS - 2","Location":""},"NewValue":{"Sites":"Champion Heights","DepartmentName":"SMS-2","Location":""}}
API Response: ", "stackTrace": ""}
{"timestamp": "2026-06-21 19:56:24.241", "level": "Error", "severity": "ERROR", "requestId": "", "httpMethod": "", "requestUrl": "", "message": "Failed to send audit log: Unauthorized
Request Payload: {"EntityTypeId":17,"EntityId":280,"ChangedBy":{"UserId":678,"Name":"Giselle Angle"},"ChangeType":"Updated","OldValue":{"Sites":"Champion Heights","DepartmentName":"SMS - 1","Location":""},"NewValue":{"Sites":"Champion Heights","DepartmentName":"SMS-1","Location":""}}
API Response: ", "stackTrace": ""}
{"timestamp": "2026-06-21 20:18:15.721", "level": "Error", "severity": "ERROR", "requestId": "", "httpMethod": "", "requestUrl": "", "message": "Failed to send audit log: Unauthorized
Request Payload: {"EntityTypeId":17,"EntityId":277,"ChangedBy":{"UserId":678,"Name":"Giselle Angle"},"ChangeType":"Updated","OldValue":{"Sites":"Champion Heights","DepartmentName":"LBM","Location":""},"NewValue":{"Sites":"Champion Heights","DepartmentName":"Light Bar Mill (LBM)","Location":""}}
API Response: ", "stackTrace": ""}
{"timestamp": "2026-06-21 20:20:36.407", "level": "Error", "severity": "ERROR", "requestId": "", "httpMethod": "", "requestUrl": "", "message": "Failed to send audit log: Unauthorized
Request Payload: {"EntityTypeId":17,"EntityId":276,"ChangedBy":{"UserId":678,"Name":"Giselle Angle"},"ChangeType":"Updated","OldValue":{"Sites":"Champion Heights","DepartmentName":"HBM","Location":""},"NewValue":{"Sites":"Champion Heights","DepartmentName":"Heavy Bar Mill (HBM)","Location":""}}
API Response: ", "stackTrace": ""}
{"timestamp": "2026-06-21 20:22:33.543", "level": "Error", "severity": "ERROR", "requestId": "", "httpMethod": "", "requestUrl": "", "message": "Failed to send audit log: Unauthorized
Request Payload: {"EntityTypeId":17,"EntityId":283,"ChangedBy":{"UserId":678,"Name":"Giselle Angle"},"ChangeType":"Updated","OldValue":{"Sites":"Champion Heights","DepartmentName":"Oxygen","Location":""},"NewValue":{"Sites":"Champion Heights","DepartmentName":"Oxygen Plant","Location":""}}
API Response: ", "stackTrace": ""}
{"timestamp": "2026-06-21 20:23:29.750", "level": "Error", "severity": "ERROR", "requestId": "", "httpMethod": "", "requestUrl": "", "message": "MySql.Data.MySqlClient.MySqlException (0x80004005): Cannot add or update a child row: a foreign key constraint fails (`qa_stg_oqsha_4`.`user_sections`, CONSTRAINT `fk_user_sections_section_id` FOREIGN KEY (`section_id`) REFERENCES `organisation_sections` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION)
   at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
   at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId)
   at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
   at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
   at Dapper.SqlMapper.ExecuteImpl(IDbConnection cnn, CommandDefinition& command)
   at Dapper.SqlMapper.Execute(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable`1 commandTimeout, Nullable`1 commandType)
   at IncidentReporter.DAL.Repositories.UsersRepo.BatchInsertUserSections(Int32 userId, Int32 orgId, IEnumerable`1 sectionIds, Int32 createdBy) in D:\work\oqsha2\incident-reporter-api\IncidentReporter\IncidentReporter.DAL\Repositories\UsersRepo.cs:line 13411
   at IncidentReporter.API.BLL.UsersBLL.<AddAllUserTypes>d__79.MoveNext() in D:\work\oqsha2\incident-reporter-api\IncidentReporter\IncidentReporter.API\BLL\UsersBLL.cs:line 5340", "stackTrace": "MySql.Data.MySqlClient.MySqlException (0x80004005): Cannot add or update a child row: a foreign key constraint fails (`qa_stg_oqsha_4`.`user_sections`, CONSTRAINT `fk_user_sections_section_id` FOREIGN KEY (`section_id`) REFERENCES `organisation_sections` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION)
   at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
   at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId)
   at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
   at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
   at Dapper.SqlMapper.ExecuteImpl(IDbConnection cnn, CommandDefinition& command)
   at Dapper.SqlMapper.Execute(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable`1 commandTimeout, Nullable`1 commandType)
   at IncidentReporter.DAL.Repositories.UsersRepo.BatchInsertUserSections(Int32 userId, Int32 orgId, IEnumerable`1 sectionIds, Int32 createdBy) in D:\work\oqsha2\incident-reporter-api\IncidentReporter\IncidentReporter.DAL\Repositories\UsersRepo.cs:line 13411
   at IncidentReporter.API.BLL.UsersBLL.<AddAllUserTypes>d__79.MoveNext() in D:\work\oqsha2\incident-reporter-api\IncidentReporter\IncidentReporter.API\BLL\UsersBLL.cs:line 5340"}
{"timestamp": "2026-06-21 20:23:30.168", "level": "Error", "severity": "ERROR", "requestId": "", "httpMethod": "", "requestUrl": "", "message": "Exception in HTTP POST logging: An error occurred while sending the request.", "stackTrace": ""}
{"timestamp": "2026-06-21 20:29:07.645", "level": "Error", "severity": "ERROR", "requestId": "", "httpMethod": "", "requestUrl": "", "message": "Failed to send audit log: Unauthorized
Request Payload: {"EntityTypeId":29,"EntityId":14023,"ChangedBy":{"UserId":678,"Name":"Giselle Angle"},"ChangeType":"Created","OldValue":null,"NewValue":{"DisplayName":"Bhuwan Tembhare","WhatsappCountryCode":"+91","WhatsappNumber":"9109119216","MobileCountryCode":"+91","MobileNumber":"9109119216","EmployeeCode":"10513.0","EmployeeType":"Employee","ContractStartedOn":"","ContractEndsOn":"","CompanyName":"Neveu","Department":"Light Bar Mill (LBM)","DateOfJoining":"","DateOfBirth":null,"ReportingManager":null,"EmergencyContactName":null,"EmergencyContactNumber":null,"Address":"","AdditionalQualifications":null,"Email":"bhuwan.tembhare@necoindia.com","UserUid":null,"ShowAllTickets":"No","SeeAllPtw":"No","ReceiveAllPtwNotifications":"No","ExemptFromGeofencing":"No","ViewAllInspections":"No","ReceiveAttendanceNotification":"No","Sites":"Champion Heights","Role":"Section Incharge","PtwRole":"","TypeOfPermits":"","AssetTypes":"","IsUserActive":"Active"}}
API Response: ", "stackTrace": ""}
{"timestamp": "2026-06-21 20:29:42.963", "level": "Error", "severity": "ERROR", "requestId": "", "httpMethod": "", "requestUrl": "", "message": "Failed to send audit log: Unauthorized
Request Payload: {"EntityTypeId":29,"EntityId":14023,"ChangedBy":{"UserId":678,"Name":"Giselle Angle"},"ChangeType":"Updated","OldValue":{"DisplayName":"Bhuwan Tembhare","WhatsappCountryCode":"+91","WhatsappNumber":"9109119216","MobileCountryCode":"+91","MobileNumber":"9109119216","EmployeeCode":"10513.0","EmployeeType":"Employee","ContractStartedOn":"","ContractEndsOn":"","CompanyName":"Neveu","Department":"Light Bar Mill (LBM)","DateOfJoining":"","DateOfBirth":null,"ReportingManager":null,"EmergencyContactName":null,"EmergencyContactNumber":null,"Address":"","AdditionalQualifications":null,"Email":"bhuwan.tembhare@necoindia.com","UserUid":null,"ShowAllTickets":"No","SeeAllPtw":"No","ReceiveAllPtwNotifications":"No","ExemptFromGeofencing":"No","ViewAllInspections":"No","ReceiveAttendanceNotification":"No","Sites":"Champion Heights","Role":"Section Incharge","PtwRole":"","TypeOfPermits":"","AssetTypes":"","IsUserActive":"Active"},"NewValue":{"DisplayName":"Bhuwan Tembhare","WhatsappCountryCode":"+91","WhatsappNumber":"9109119216","MobileCountryCode":"+91","MobileNumber":"9109119216","EmployeeCode":"10513","EmployeeType":"Employee","ContractStartedOn":"","ContractEndsOn":"","CompanyName":"Neveu","Department":"Light Bar Mill (LBM)","DateOfJoining":"","DateOfBirth":null,"ReportingManager":null,"EmergencyContactName":"","EmergencyContactNumber":"","Address":"","AdditionalQualifications":null,"Email":"bhuwan.tembhare@abc.com","UserUid":null,"ShowAllTickets":"No","SeeAllPtw":"No","ReceiveAllPtwNotifications":"No","ExemptFromGeofencing":"No","ViewAllInspections":"No","ReceiveAttendanceNotification":"No","Sites":"Champion Heights","Role":"Section Incharge","PtwRole":"","TypeOfPermits":"","AssetTypes":"","IsUserActive":"Active"}}
API Response: ", "stackTrace": ""}
{"timestamp": "2026-06-21 20:38:03.719", "level": "Error", "severity": "ERROR", "requestId": "", "httpMethod": "", "requestUrl": "", "message": "Failed to send audit log: Unauthorized
Request Payload: {"EntityTypeId":29,"EntityId":14024,"ChangedBy":{"UserId":678,"Name":"Giselle Angle"},"ChangeType":"Created","OldValue":null,"NewValue":{"DisplayName":"Bhuwan Tembhare","WhatsappCountryCode":"+91","WhatsappNumber":"9109119216","MobileCountryCode":"+91","MobileNumber":"9109119216","EmployeeCode":"10513","EmployeeType":"Employee","ContractStartedOn":"","ContractEndsOn":"","CompanyName":"Neveu","Department":"Light Bar Mill (LBM)","DateOfJoining":"","DateOfBirth":null,"ReportingManager":null,"EmergencyContactName":null,"EmergencyContactNumber":null,"Address":"","AdditionalQualifications":null,"Email":"bhuwan.tembhare@abc.co","UserUid":null,"ShowAllTickets":"No","SeeAllPtw":"No","ReceiveAllPtwNotifications":"No","ExemptFromGeofencing":"No","ViewAllInspections":"No","ReceiveAttendanceNotification":"No","Sites":"Champion Heights","Role":"Section Incharge","PtwRole":"","TypeOfPermits":"","AssetTypes":"","IsUserActive":"Active"}}
API Response: ", "stackTrace": ""}
