Skip to content

NoMethodError undefined method 'graphql_parent' for nil #5444

@cocoahero

Description

@cocoahero

We're encountering a very strange exception in production.

NoMethodError undefined method 'graphql_parent' for nil

lib/graphql/execution/interpreter/runtime.rb:940 GraphQL::Execution::Interpreter::Runtime#after_lazy
lib/graphql/execution/interpreter/runtime.rb:479 block in GraphQL::Execution::Interpreter::Runtime#evaluate_selection_with_resolved_keyword_args
lib/graphql/execution/interpreter/runtime.rb:820 GraphQL::Execution::Interpreter::Runtime#call_method_on_directives
lib/graphql/execution/interpreter/runtime.rb:454 GraphQL::Execution::Interpreter::Runtime#evaluate_selection_with_resolved_keyword_args
lib/graphql/execution/interpreter/runtime.rb:432 block in GraphQL::Execution::Interpreter::Runtime#evaluate_selection_with_args
lib/graphql/execution/interpreter/runtime.rb:947 GraphQL::Execution::Interpreter::Runtime#after_lazy
lib/graphql/execution/interpreter/runtime.rb:377 GraphQL::Execution::Interpreter::Runtime#evaluate_selection_with_args
lib/graphql/execution/interpreter/runtime.rb:371 block in GraphQL::Execution::Interpreter::Runtime#evaluate_selection
lib/graphql/execution/interpreter/arguments_cache.rb:46 block in GraphQL::Execution::Interpreter::ArgumentsCache#dataload_for
lib/graphql/schema/member/has_arguments.rb:272 block (3 levels) in GraphQL::Schema::Member::HasArguments#coerce_arguments
lib/graphql/dataloader/null_dataloader.rb:56 GraphQL::Dataloader::NullDataloader#append_job
lib/graphql/schema/member/has_arguments.rb:253 block (2 levels) in GraphQL::Schema::Member::HasArguments#coerce_arguments
lib/graphql/schema/member/has_arguments.rb:252 Array#each
lib/graphql/schema/member/has_arguments.rb:252 block in GraphQL::Schema::Member::HasArguments#coerce_arguments
lib/graphql/schema/member/has_arguments.rb:281 GraphQL::Schema::Member::HasArguments#coerce_arguments
lib/graphql/execution/interpreter/arguments_cache.rb:44 GraphQL::Execution::Interpreter::ArgumentsCache#dataload_for
lib/graphql/execution/interpreter/runtime.rb:365 GraphQL::Execution::Interpreter::Runtime#evaluate_selection
lib/graphql/execution/interpreter/runtime.rb:314 block (3 levels) in GraphQL::Execution::Interpreter::Runtime#evaluate_selections
lib/graphql/dataloader/null_dataloader.rb:56 GraphQL::Dataloader::NullDataloader#append_job
lib/graphql/execution/interpreter/runtime.rb:313 block (2 levels) in GraphQL::Execution::Interpreter::Runtime#evaluate_selections
lib/graphql/execution/interpreter/runtime.rb:300 Hash#each
lib/graphql/execution/interpreter/runtime.rb:300 block in GraphQL::Execution::Interpreter::Runtime#evaluate_selections
lib/graphql/execution/interpreter/runtime.rb:820 GraphQL::Execution::Interpreter::Runtime#call_method_on_directives
lib/graphql/execution/interpreter/runtime.rb:299 GraphQL::Execution::Interpreter::Runtime#evaluate_selections
lib/graphql/execution/interpreter/runtime.rb:110 block (3 levels) in GraphQL::Execution::Interpreter::Runtime#run_eager
lib/graphql/dataloader/null_dataloader.rb:56 GraphQL::Dataloader::NullDataloader#append_job
lib/graphql/execution/interpreter/runtime.rb:109 block (2 levels) in GraphQL::Execution::Interpreter::Runtime#run_eager
lib/graphql/execution/interpreter/runtime.rb:208 GraphQL::Execution::Interpreter::Runtime#each_gathered_selections
lib/graphql/execution/interpreter/runtime.rb:98 block in GraphQL::Execution::Interpreter::Runtime#run_eager
lib/graphql/execution/interpreter/runtime.rb:827 GraphQL::Execution::Interpreter::Runtime#run_directive
lib/graphql/execution/interpreter/runtime.rb:851 block in GraphQL::Execution::Interpreter::Runtime#run_directive

In looking at the code, this exception feels impossible given the while result check. I thought perhaps maybe its concurrency and or fibers, but we're using the NullDataloader as seen in the stacktrace.

I've put my best people on it (Claude Sonnet 4.5) and they are also very puzzled on how this could occur. The best idea so far is a variable shadowing bug (since result is reused several places within after_lazy), but its a long-shot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions