We are leaving Russia. We are against aggression and war with Ukraine. It is a tragedy for our nations, it is a nightmare

Jobs can't retry due to no "jobid" column found

Hi, Im using Hangfire 1.7.27 with Npgsql.EntityFrameworkCore.PostgreSQL 6.0.0

I have some simple job that is failing. I expect that job will be retried, but every retry finishes with error:

[14:10:46 ERR] 10 state change attempt(s) failed due to an exception, moving job to the FailedState
Npgsql.PostgresException (0x80004005): 42703: column "jobid" does not exist

POSITION: 37
   at Npgsql.Internal.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|213_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
   at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
   at Npgsql.NpgsqlDataReader.NextResult()
   at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.ExecuteNonQuery()
   at Dapper.SqlMapper.ExecuteCommand(IDbConnection cnn, CommandDefinition& command, Action`2 paramReader) in /_/Dapper/SqlMapper.cs:line 2822
   at Dapper.SqlMapper.ExecuteImpl(IDbConnection cnn, CommandDefinition& command) in /_/Dapper/SqlMapper.cs:line 572
   at Dapper.SqlMapper.Execute(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 443
   at Hangfire.PostgreSql.PostgreSqlConnection.SetJobParameter(String id, String name, String value)
   at Hangfire.States.ElectStateContext.SetJobParameter[T](String name, T value)
   at Hangfire.AutomaticRetryAttribute.ScheduleAgainLater(ElectStateContext context, Int32 retryAttempt, FailedState failedState)
   at Hangfire.AutomaticRetryAttribute.OnStateElection(ElectStateContext context)
   at Hangfire.States.StateMachine.InvokeOnStateElection(Tuple`2 x)
   at Hangfire.Profiling.ProfilerExtensions.InvokeAction[TInstance](InstanceAction`1 tuple)
   at Hangfire.Profiling.SlowLogProfiler.InvokeMeasured[TInstance,TResult](TInstance instance, Func`2 action, String message)
   at Hangfire.Profiling.ProfilerExtensions.InvokeMeasured[TInstance](IProfiler profiler, TInstance instance, Action`1 action, String message)
   at Hangfire.States.StateMachine.ApplyState(ApplyStateContext initialContext)
   at Hangfire.States.BackgroundJobStateChanger.ChangeState(StateChangeContext context)
   at Hangfire.Server.Worker.TryChangeState(BackgroundProcessContext context, IStorageConnection connection, IFetchedJob fetchedJob, IState state, String[] expectedStates, CancellationToken initializeToken, CancellationToken abortToken)
  Exception data:
    Severity: ERROR
    SqlState: 42703
    MessageText: column "jobid" does not exist
    Position: 37
    File: parse_relation.c
    Line: 3514
    Routine: errorMissingColumn

I’ve checked jobparameter table - it has jobid column with type bigint.

I’ve tried to recreate database for Hangfire, but with no luck.

Finally recreation of the database helped me.
After that I’ve compared the old database and newly migrated one and didn’t found any differences.
Very strange bug…

Is it possible that you upgraded Hangfire.PostgreSql in that time? There was a known issue about this that has since been resolved.