Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
Title: Read tool hangs indefinitely on Ruby files with a specific block variable name collision
Steps to Reproduce
Summary
The Cursor Read tool hangs for 60–130 seconds (then times out) when a Ruby file contains both of these patterns simultaneously:
A block variable named account_id produced by group_by(&:account_id):
array.group_by(&:account_id).each do |account_id, items|
A map call accessing .account_id on a block variable in a different method:
def some_method(events)
events.map { |e| e.account_id }.uniq
or: events.map(&:account_id).uniq
end
Minimal reproduction
class Example
Item = Struct.new(:account_id, :value)
def method_a(items)
items.group_by(&:account_id).each do |account_id, group|
puts account_id
end
end
def method_b(items)
items.map { |e| e.account_id }.uniq # ← triggers hang
end
end
Evidence from systematic debugging
Change Read tool result
map { |e| 1 } (no field access)
Instant ![]()
map { |e| e.ticket_id } (different field name)
Instant ![]()
map { |e| e.account_id }
Hangs 60–130s ![]()
map(&:account_id)
Hangs 60–130s ![]()
Rename block var to acct_id → then map { |e| e.account_id }
Instant ![]()
Root cause hypothesis
Cursor’s Ruby scope/type resolver encounters the name account_id used both as a local block variable (in method_a) and as a field accessor (in method_b), and enters an expensive or infinite cross-reference loop trying to unify the two references.
Workaround
Rename the block variable to avoid the collision:
array.group_by(&:account_id).each do |acct_id, items|
Notes
Machine restarts temporarily resolve the hang (likely clears a cached/stuck analysis state)
cat/sed via terminal always reads the file instantly regardless
The bug is not about file size — it reproduces at 158 lines
Expected Behavior
should be able to read ruby file
Operating System
MacOS
Version Information
OS: macOS darwin 24.6.0
File type: Ruby (.rb)
Models affected: Claude Sonnet 4.6, also reproduced with ChatGPT models
Cursor version: (check Help > About)
For AI issues: which model did you use?
Claude Sonnet 4.6, but also failed for Chat GPT 5.3 and 5.5
Does this stop you from using Cursor
Yes - Cursor is unusable