Skip to content

GraphQL 500 Internal Server Error : jobRetry mutation

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

The GraphQL mutation jobRetry caused a 500 Internal Server Error. The error occurred due to an ActiveRecord::RecordNotFound exception, indicating that the specified record (Ci::Processable with 'id'=1) could not be found.

Steps to Reproduce

  1. Execute the GraphQL mutation jobRetry as shown below:

    mutation jobRetry {
      jobRetry(input: {id: "gid://gitlab/Ci::Processable/1"}) {
        clientMutationId
        errors
        job {
          active
        }
      }
    }
  2. Use the following variables:

    {
      "input": {
        "id": "gid://gitlab/Ci::Processable/1"
      }
    }
  3. Observe that the system returns a 500 status code.

Example Project

  • Docker Image: Version 17.4.1-ce

Current Bug Behavior

  • The GraphQL mutation jobRetry results in a 500 Internal Server Error.
  • The error indicates that the record (Ci::Processable with 'id'=1) could not be found, causing an unhandled server-side failure.

Expected Correct Behavior

  • The expected result should be:
    • A 200 status code with either:
      • Successful retry of the job, or
      • An error object indicating that the resource could not be found, without causing an internal server failure.

Relevant Logs / Error Details

GraphQL Mutation Query:

"query": "mutation jobRetry { jobRetry(input: {id: \"gid://gitlab/Ci::Processable/1\"}) { clientMutationId errors job { active } } }"

Error Trace:

ActiveRecord::RecordNotFound: Couldn't find Ci::Processable with 'id'=1 [WHERE "p_ci_builds"."type" IN ($1, $2, $3)]

activerecord (7.0.8.4) lib/active_record/relation/finder_methods.rb:381:in `raise_record_not_found_exception!'
activerecord (7.0.8.4) lib/active_record/relation/finder_methods.rb:475:in `find_one'
activerecord (7.0.8.4) lib/active_record/relation/finder_methods.rb:457:in `find_with_ids'
activerecord (7.0.8.4) lib/active_record/relation/finder_methods.rb:69:in `find'
activerecord (7.0.8.4) lib/active_record/querying.rb:22:in `find'
activerecord (7.0.8.4) lib/active_record/core.rb:271:in `find'
globalid (1.1.0) lib/global_id/locator.rb:129:in `locate'
globalid (1.1.0) lib/global_id/locator.rb:154:in `block in locate'
globalid (1.1.0) lib/global_id/locator.rb:164:in `block in unscoped'
activerecord (7.0.8.4) lib/active_record/relation.rb:881:in `_scoping'
activerecord (7.0.8.4) lib/active_record/relation.rb:428:in `scoping'
activerecord (7.0.8.4) lib/active_record/scoping/default.rb:43:in `unscoped'
globalid (1.1.0) lib/global_id/locator.rb:164:in `unscoped'
globalid (1.1.0) lib/global_id/locator.rb:154:in `locate'
globalid (1.1.0) lib/global_id/locator.rb:16:in `locate'
app/graphql/mutations/ci/job/base.rb:14:in `find_object'
lib/gitlab/graphql/authorize/authorize_resource.rb:53:in `authorized_find!'
app/graphql/mutations/ci/job/retry.rb:29:in `resolve'
graphql (2.3.15) lib/graphql/schema/resolver.rb:121:in `public_send'
graphql (2.3.15) lib/graphql/schema/resolver.rb:121:in `call_resolve'
graphql (2.3.15) lib/graphql/schema/mutation.rb:69:in `call_resolve'
graphql (2.3.15) lib/graphql/schema/resolver.rb:108:in `block (3 levels) in resolve_with_support'
graphql (2.3.15) lib/graphql/schema.rb:1413:in `after_lazy'
graphql (2.3.15) lib/graphql/query.rb:393:in `after_lazy'
graphql (2.3.15) lib/graphql/schema/resolver.rb:96:in `block (2 levels) in resolve_with_support'
graphql (2.3.15) lib/graphql/schema.rb:1413:in `after_lazy'
graphql (2.3.15) lib/graphql/query.rb:393:in `after_lazy'
graphql (2.3.15) lib/graphql/schema/resolver.rb:87:in `block in resolve_with_support'
graphql (2.3.15) lib/graphql/schema.rb:1413:in `after_lazy'
graphql (2.3.15) lib/graphql/query.rb:393:in `after_lazy'
graphql (2.3.15) lib/graphql/schema/resolver.rb:75:in `resolve_with_support'
graphql (2.3.15) lib/graphql/schema/has_single_input_argument.rb:36:in `resolve_with_support'
graphql (2.3.15) lib/graphql/schema/relay_classic_mutation.rb:45:in `resolve_with_support'
graphql (2.3.15) lib/graphql/schema/field.rb:735:in `public_send'
graphql (2.3.15) lib/graphql/schema/field.rb:735:in `block (2 levels) in resolve'
graphql (2.3.15) lib/graphql/schema/field.rb:880:in `block in with_extensions'
graphql (2.3.15) lib/graphql/schema/field.rb:916:in `block (2 levels) in run_extensions_before_resolve'
graphql (2.3.15) lib/graphql/schema/field.rb:916:in `block (2 levels) in run_extensions_before_resolve'
graphql (2.3.15) lib/graphql/schema/field.rb:919:in `run_extensions_before_resolve'
graphql (2.3.15) lib/graphql/schema/field.rb:916:in `block in run_extensions_before_resolve'
graphql (2.3.15) lib/graphql/schema/field_extension.rb:134:in `resolve'
graphql (2.3.15) lib/graphql/schema/field.rb:903:in `run_extensions_before_resolve'
graphql (2.3.15) lib/graphql/schema/field.rb:916:in `block in run_extensions_before_resolve'
lib/gitlab/graphql/present/field_extension.rb:18:in `resolve'
graphql (2.3.15) lib/graphql/schema/field.rb:903:in `run_extensions_before_resolve'
graphql (2.3.15) lib/graphql/schema/field.rb:875:in `with_extensions'
graphql (2.3.15) lib/graphql/schema/field.rb:706:in `block in resolve'
graphql (2.3.15) lib/graphql/schema.rb:1413:in `after_lazy'
graphql (2.3.15) lib/graphql/query.rb:393:in `after_lazy'
graphql (2.3.15) lib/graphql/schema/field.rb:704:in `resolve'
graphql (2.3.15) lib/graphql/execution/interpreter/runtime.rb:375:in `block (2 levels) in evaluate_selection_with_resolved_keyword_args'
graphql (2.3.15) lib/graphql/tracing/trace.rb:52:in `execute_field'
batch-loader (2.0.5) lib/batch_loader/graphql.rb:7:in `execute_field'
graphql (2.3.15) lib/graphql/schema/timeout.rb:84:in `execute_field'
...
Edited by 🤖 GitLab Bot 🤖