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

**URL:** https://discuss.hangfire.io/t/jobs-cant-retry-due-to-no-jobid-column-found/8808
**Category:** bug?
**Tags:** postgres
**Created:** [November 24, 2021, 11:16am UTC](https://discuss.hangfire.io/t/jobs-cant-retry-due-to-no-jobid-column-found/8808 "2021-11-24T11:16:39Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ZlobnyiSerg](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/zlobnyiserg/32/1425_2.png) [@ZlobnyiSerg](https://discuss.hangfire.io/u/ZlobnyiSerg)
#### Post date: [November 24, 2021, 11:16am UTC](https://discuss.hangfire.io/t/jobs-cant-retry-due-to-no-jobid-column-found/8808/1 "2021-11-24T11:16:39Z")

</div>

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:

```auto
[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.

---

<div class="post-metadata">

### Author: ![ZlobnyiSerg](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/zlobnyiserg/32/1425_2.png) [@ZlobnyiSerg](https://discuss.hangfire.io/u/ZlobnyiSerg)
#### Post date: [December 14, 2021, 1:50pm UTC](https://discuss.hangfire.io/t/jobs-cant-retry-due-to-no-jobid-column-found/8808/2 "2021-12-14T13:50:01Z")

</div>

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…

---

<div class="post-metadata">

### Author: ![aamir0](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/aamir0/32/2775_2.png) [@aamir0](https://discuss.hangfire.io/u/aamir0)
#### Post date: [December 22, 2021, 10:41pm UTC](https://discuss.hangfire.io/t/jobs-cant-retry-due-to-no-jobid-column-found/8808/3 "2021-12-22T22:41:41Z")

</div>

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

> <https://github.com/frankhommers/Hangfire.PostgreSql/issues/214>
>
> This took me a while to figure out, as I thought at first it was a bug executing… the job itself, but then thought that my job should be failing otherwise all the jobs should have been failing ,but some worked just fine, and others failed all the time with this error.
> 
> \`\`\`
> 42703: column "jobid" does not exist
> \`\`\`
> 
> The stacktrace points to:
> \`Hangfire.PostgreSql.PostgreSqlConnection.SetJobParamete\`
> 
> 
> This is the stack trace :
> \`\`\`
> 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)
> \`\`\`
