Ruby NoMethodError / "Did you mean?" Typo in CI
Ruby raised a NoMethodError or NameError and the built-in did_you_mean gem offered a close match. The error is a genuine typo or a method that does not exist on that object - not a transient failure.
What this error means
A call fails with "undefined method 'X' for ..." (NoMethodError) or "undefined local variable or method" and a "Did you mean? Y" line. The suggested name is usually what you meant.
NoMethodError: undefined method `lenght' for an instance of String
Did you mean? lengthCommon causes
Misspelled method or variable name
The method or name does not exist as written. did_you_mean compares against the available methods and suggests the closest one - almost always the fix.
Method exists on a different object/version
The method exists on another class, or was added/removed in a different gem version, so it is undefined on the receiver you have. A dependency change can make a previously valid call disappear.
How to fix it
Apply the suggested name
Take the did_you_mean suggestion when it matches your intent.
# undefined method 'lenght' -> use 'length'
"hello".lengthConfirm the receiver and version
- Check the object’s class and that the method exists on it (respond_to?).
- If a gem upgrade removed the method, pin a compatible version or migrate to the new API.
- Keep did_you_mean enabled in CI so suggestions appear in logs.
How to prevent it
- Run a linter (RuboCop) and tests in CI to catch typos before merge.
- Pin or range-constrain gems so a method does not vanish on upgrade.
- Keep did_you_mean enabled for helpful suggestions in CI output.