Ruby Error Reference
Common Ruby and Rails errors explained with causes, fixes, and code examples
Ruby Core Errors
Standard Ruby exception classes you'll encounter in any Ruby application.
NoMethodError is raised when a method is called on an object that doesn't define it. This commonly happens when calling a method on nil, or when there's a typo in the method name.
ArgumentError is raised when a method receives an argument it cannot handle. This includes wrong number of arguments, invalid argument values, or incompatible argument types.
TypeError is raised when an object is not of the expected type. This happens when Ruby can't implicitly convert one type to another, or when an operation is incompatible with the object's type.
NameError is raised when Ruby encounters a name (variable, constant, or method) that it doesn't recognize. This is different from NoMethodError which specifically involves methods on objects.
RuntimeError is a generic error class raised when something goes wrong during program execution. It's the default exception type when you call raise without specifying an exception class.
KeyError is raised when accessing a hash key that doesn't exist using fetch() without a default value, or when using ENV.fetch() for missing environment variables.
IndexError is raised when trying to access an array element at an index that doesn't exist, typically when using fetch() or certain array methods.
LoadError is raised when Ruby cannot load a file via require or load. This usually means the file doesn't exist, the gem isn't installed, or the load path is incorrect.
SyntaxError is raised when Ruby's parser encounters code that doesn't conform to Ruby's syntax rules. This happens at parse time, before the code runs.
ZeroDivisionError is raised when attempting to divide an integer by zero. Note that dividing floats by zero returns Infinity instead of raising an error.
Rails & ActiveRecord Errors
Errors specific to Ruby on Rails, ActiveRecord, and ActionPack.
ActiveRecord::RecordNotFound is raised when using find(), find_by!(), or first!/last! methods with an ID or conditions that match no records in the database.
ActiveRecord::RecordInvalid is raised when calling save!, create!, or update! on a record that fails validation. The bang methods raise exceptions instead of returning false.
ActiveRecord::RecordNotUnique is raised when attempting to insert or update a record that would violate a database-level unique constraint.
ActionController::RoutingError is raised when Rails cannot find a route matching the requested URL. This typically results in a 404 Not Found response.
ActionController::ParameterMissing is raised when using require() on params and the required key is missing. This is part of Rails strong parameters.
ActionController::UnknownFormat is raised when a request asks for a format (like JSON or XML) that the controller action doesn't support via respond_to.
ActionView::MissingTemplate is raised when Rails cannot find a view template for the current action. This happens when render is called (explicitly or implicitly) but the template file doesn't exist.
ActionView::Template::Error wraps errors that occur during template rendering. The original error (NoMethodError, NameError, etc.) is wrapped to include template context.
ActiveRecord::ConnectionNotEstablished is raised when Rails cannot connect to the database. This can happen at startup or during runtime if the connection is lost.
ActiveRecord::StatementInvalid is raised when an SQL statement is invalid or fails to execute. This wraps database-specific errors like syntax errors, constraint violations, or missing columns.
Track all these errors automatically
Checkend captures Ruby errors with full context—backtraces, request data, and more. Self-hosted, so your error data stays on your servers.