Error map
undefined method for nil Ruby: NoMethodError: undefined method `x' for nil (nil:NilClass)
Ruby / Rails · layer 4, Application & API
Centre: this error. First ring: errors it is linked with (11). Outer ring: what those are linked with. Colours show the layer of a request each error belongs to. Click any dot to re-centre the map on it; hover to follow its connections. The centre dot opens the error page.
Directly related (11)
Rails: ActiveRecord::PendingMigrationError — Migrations are pending. To resolve this issue, run: bin/rails db:migrate
The database schema is behind the migration files in the app.
Rails: ActionController::InvalidAuthenticityToken (Can't verify CSRF token authenticity)
A non-GET request arrived without a valid CSRF token for the session.
Rails: ActiveRecord::RecordNotFound: Couldn't find User with 'id'=42
`find`/`find_by!` didn't find a row, so Rails raises (and renders a 404 in production).
Rails: ActionController::UrlGenerationError: No route matches {:action=>"show", :controller=>"users", :id=>nil}, missing required keys: [:id]
A URL helper (`user_path(@user)`) was called without a value Rails needs (usually `nil` object).
Rails: ActionView::Template::Error (undefined method `name' for nil:NilClass): app/views/users/show.html.erb:3
A view called a method on `nil` (or an undefined helper), so rendering failed — the error is wrapped in `ActionView::Template::Er…
Ruby: NameError: uninitialized constant UsersController::User (Did you mean? Users)
Ruby (or Rails autoloading) couldn't find a class or module with that name in the current scope.
Ruby: NameError: undefined local variable or method 'x' for main:Object
Ruby saw a bare identifier that is neither a local variable nor a method on the current object.
Ruby: ArgumentError: wrong number of arguments (given 1, expected 2..3)
A method was called with more or fewer arguments than it accepts.
Ruby: ArgumentError: missing keyword: :name / unknown keyword: :nmae
A method requiring keyword arguments was called without them, or with a misspelt keyword.
Ruby: TypeError: no implicit conversion of nil into String
A String method (`+`, `File.join`, `Array#join` usage) received `nil` instead of a string.
Ruby: TypeError: nil can't be coerced into Integer / String can't be coerced into Integer
Arithmetic combined a number with `nil` (or a String) which Ruby can't convert automatically.
Two steps away (24)
MySQL ERROR 1146 (42S02): Table 'db.table' doesn't exist
The query references a table that MySQL can’t find in that database.
PostgreSQL: ERROR: relation "x" does not exist
The table/view isn’t found — missing migration, wrong schema, or a case-sensitive quoted name.
MySQL ERROR 1022 (23000): Can't write; duplicate key in table
An ALTER/CREATE produced a duplicate key or constraint name — often a foreign key name that already exists in the database.
Laravel: 419 Page Expired (CSRF token mismatch)
Laravel rejected a POST because the CSRF token was missing, expired or didn’t match the session.
Forbidden (403) CSRF verification failed. Request aborted.
Django rejected a POST because the CSRF token was missing, wrong, or the request origin isn’t trusted.
OAuth callback error: state mismatch / Unable to verify authorization request state / State cookie was missing
The state value returned to the callback doesn’t match what the app stored before redirecting — the CSRF protection for OAuth fai…
Rails: ActiveRecord::RecordInvalid: Validation failed: Email can't be blank, Name is too short
`save!`/`create!`/`update!` raised because validations failed.
Rails: ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_users_on_email"
A unique index rejected an insert/update because the value already exists.
Rails: ActiveRecord::ConnectionNotEstablished: No connection pool for 'ActiveRecord::Base' found
ActiveRecord has no database connection configured or established for this process.
connect: Network is unreachable (ENETUNREACH)
The host has no route to the destination network — no default gateway, interface down, or trying IPv6 without IPv6 connectivity.
Rails: ActiveRecord::IrreversibleMigration — This migration uses remove_column without a type; db:rollback can't reverse it
`rails db:rollback` can't undo the migration because it contains an operation Rails can't invert.
Rails: ActiveRecord::Deadlocked: PG::TRDeadlockDetected: ERROR: deadlock detected
Two transactions locked rows in opposite orders, so PostgreSQL aborted one.
Rails: ActionView::MissingTemplate (Missing template users/show, application/show with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder]})
The action tried to render a view that doesn't exist for the requested format/handler.
Rails: ActiveRecord::AssociationTypeMismatch: User(#1234) expected, got "42" which is an instance of String(#5678)
You assigned the wrong kind of object (or an id string) to an association.
Ruby: LoadError: cannot load such file -- nokogiri (or: cannot load such file -- bundler/setup)
`require` couldn't find the file/gem — it isn't installed, not in the Gemfile, or the load path is wrong.
Rails: Zeitwerk::NameError: expected file app/models/user_profile.rb to define constant UserProfile, but didn't
Rails autoloading found a file whose name implies a constant the file doesn't define.
Ruby: FrozenError: can't modify frozen String: "abc"
You tried to change an object that's frozen — string literals under `# frozen_string_literal: true`, constants, symbols or frozen…
macOS: ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory
`gem install` tries to write into Apple's system Ruby, which is protected and shouldn't be modified.
Bundler: Could not find gem 'rails (~> 7.1)' in locally installed gems / Could not find rails-7.1.0 in any of the gem sources listed in your Gemfile
A gem from the Gemfile/Gemfile.lock isn't installed (or isn't available at that version).
Bundler: Bundler could not find compatible versions for gem "activesupport": In Gemfile: rails (= 7.1.0) depends on activesupport (= 7.1.0)
Two gems in your Gemfile require incompatible versions of a shared dependency.
Ruby: ERROR: Failed to build gem native extension. current directory: /gems/pg-1.5.4/ext/pg — An error occurred while installing pg
A gem with C code couldn't compile, usually because a system library or header is missing.
Bundler: Your bundle only supports platforms ["x86_64-linux"] but your local platform is arm64-darwin / Could not find gem 'nokogiri (1.16.0-arm64-darwin)'
The lockfile has no Nokogiri build for the current platform (precompiled "native" gems are per platform).
Bundler: Your Ruby version is 3.1.2, but your Gemfile specified 3.3.0
`.ruby-version`/the Gemfile `ruby` line requires a different Ruby than the one running.
FactoryBot: FactoryBot::DuplicateDefinitionError: Factory already registered: user
Two factory definitions use the same name (or files are loaded twice).
Map another error
Popular: 500403400ORA-009331064Critical errorFileNotFoundException assemblyTypeError