Error map

NameError: undefined local variable or method Ruby: NameError: undefined local variable or method 'x' for main:Object

Ruby / Rails · layer 4, Application & API

Open the full error page →

Centre: this error. First ring: errors it is linked with (9). 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.

NameError: undefined local variable or method — Ruby: NameError: undefined local variable or method 'x' for main:Object (Ruby / Rails)NameError: …undefined method for nil — Ruby: NoMethodError: undefined method `x' for nil (nil:NilClass) (Ruby / Rails)undefined method fo…FrozenError: can't modify frozen String — Ruby: FrozenError: can't modify frozen String: "abc" (Ruby / Rails)FrozenError: can't …ActiveRecord::IrreversibleMigration — Rails: ActiveRecord::IrreversibleMigration — This migration uses remove_column without a type; db:rollback can't reverse it (Ruby / Rails)ActiveRecord::Irrev…ArgumentError: missing keyword / unknown keyword — Ruby: ArgumentError: missing keyword: :name / unknown keyword: :nmae (Ruby / Rails)ArgumentError: miss…ActiveRecord::Deadlocked: PG::TRDeadlockDetected — Rails: ActiveRecord::Deadlocked: PG::TRDeadlockDetected: ERROR: deadlock detected (Ruby / Rails)ActiveRecord::Deadl…NameError: uninitialized constant — Ruby: NameError: uninitialized constant UsersController::User (Did you mean? Users) (Ruby / Rails)NameError: uninitia…ArgumentError: wrong number of arguments (given 1, expected 2) — Ruby: ArgumentError: wrong number of arguments (given 1, expected 2..3) (Ruby / Rails)ArgumentError: wron…ActiveRecord::ConnectionNotEstablished — Rails: ActiveRecord::ConnectionNotEstablished: No connection pool for 'ActiveRecord::Base' found (Ruby / Rails)ActiveRecord::Conne…ActiveRecord::AssociationTypeMismatch — Rails: ActiveRecord::AssociationTypeMismatch: User(#1234) expected, got "42" which is an instance of String(#5678) (Ruby / Rails)ActiveRecord::Assoc…ActiveRecord::PendingMigrationError — Rails: ActiveRecord::PendingMigrationError — Migrations are pending. To resolve this issue, run: bin/rails db:migrate (Ruby / Rails)ActiveRecord::Pendi…ActionController::InvalidAuthenticityToken — Rails: ActionController::InvalidAuthenticityToken (Can't verify CSRF token authenticity) (Ruby / Rails)ActionController::I…TypeError: no implicit conversion of nil into String — Ruby: TypeError: no implicit conversion of nil into String (Ruby / Rails)TypeError: no impli…Bundler: Could not find gem in locally installed gems — 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 (Ruby / Rails)Bundler: Could not …Bundler could not find compatible versions for gem — Bundler: Bundler could not find compatible versions for gem "activesupport": In Gemfile: rails (= 7.1.0) depends on activesupport (= 7.1.0) (Ruby / Rails)Bundler could not f…FactoryBot::DuplicateDefinitionError: Factory already registered — FactoryBot: FactoryBot::DuplicateDefinitionError: Factory already registered: user (Ruby / Rails)FactoryBot::Duplica…1146 — MySQL ERROR 1146 (42S02): Table 'db.table' doesn't exist (MySQL)114642P01 — PostgreSQL: ERROR: relation "x" does not exist (PostgreSQL)42P011022 — MySQL ERROR 1022 (23000): Can't write; duplicate key in table (MySQL)1022You don't have write permissions for the /Library/Ruby/Gems directory — macOS: ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory (macOS)You don't have writ…TypeError: nil can't be coerced into Integer — Ruby: TypeError: nil can't be coerced into Integer / String can't be coerced into Integer (Ruby / Rails)TypeError: nil can'…LoadError: cannot load such file — Ruby: LoadError: cannot load such file -- nokogiri (or: cannot load such file -- bundler/setup) (Ruby / Rails)LoadError: cannot l…ActiveRecord::RecordNotFound: Couldn't find X with 'id'= — Rails: ActiveRecord::RecordNotFound: Couldn't find User with 'id'=42 (Ruby / Rails)ActiveRecord::Recor…ActiveRecord::RecordInvalid: Validation failed — Rails: ActiveRecord::RecordInvalid: Validation failed: Email can't be blank, Name is too short (Ruby / Rails)ActiveRecord::Recor…PG::UndefinedTable: relation does not exist — Rails: ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "users" does not exist (Ruby / Rails)PG::UndefinedTable:…Zeitwerk::NameError: expected file to define constant — Rails: Zeitwerk::NameError: expected file app/models/user_profile.rb to define constant UserProfile, but didn't (Ruby / Rails)Zeitwerk::NameError…Failed to build gem native extension — Ruby: ERROR: Failed to build gem native extension. current directory: /gems/pg-1.5.4/ext/pg — An error occurred while installing pg (Ruby / Rails)Failed to build gem…Your Ruby version is X, but your Gemfile specified Y — Bundler: Your Ruby version is 3.1.2, but your Gemfile specified 3.3.0 (Ruby / Rails)Your Ruby version i…RSpec::Expectations::ExpectationNotMetError: expected X got Y — RSpec: expected: 200 got: 404 (compared using ==) — RSpec::Expectations::ExpectationNotMetError (Ruby / Rails)RSpec::Expectations…Error: connect ECONNREFUSED 127.0.0.1:6379 — Redis: Error: connect ECONNREFUSED 127.0.0.1:6379 / Could not connect to Redis at 127.0.0.1:6379: Connection refused (Redis)Error: connect ECON…Redis TLS: SSL handshake error / protocol mismatch — Redis: Error: write EPROTO ... SSL routines:ssl3_get_record:wrong version number / Connection reset by peer (TLS vs plaintext) (Redis)Redis TLS: SSL hand…ECONNRESET / Connection reset by peer on idle Redis connection — Redis: Error: read ECONNRESET / redis.exceptions.ConnectionError: Connection reset by peer after idle time (Redis)ECONNRESET / Connec…Mysql2::Error: Unknown column in field list — Rails: ActiveRecord::StatementInvalid: Mysql2::Error: Unknown column 'users.nickname' in 'field list' (Ruby / Rails)Mysql2::Error: Unkn…ActiveRecord::RecordNotUnique: duplicate key value — Rails: ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_users_on_email" (Ruby / Rails)ActiveRecord::Recor…PG::ConnectionBad: could not connect to server — Rails: PG::ConnectionBad: could not connect to server: Connection refused. Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432? (Ruby / Rails)PG::ConnectionBad: …

Directly related (9)

undefined method for nilRuby / Rails

Ruby: NoMethodError: undefined method `x' for nil (nil:NilClass)

You called a method on nil — the object you expected (a record, hash value, param) wasn’t there.

FrozenError: can't modify frozen StringRuby / Rails

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…

ActiveRecord::IrreversibleMigrationRuby / Rails

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.

ArgumentError: missing keyword / unknown keywordRuby / Rails

Ruby: ArgumentError: missing keyword: :name / unknown keyword: :nmae

A method requiring keyword arguments was called without them, or with a misspelt keyword.

ActiveRecord::Deadlocked: PG::TRDeadlockDetectedRuby / Rails

Rails: ActiveRecord::Deadlocked: PG::TRDeadlockDetected: ERROR: deadlock detected

Two transactions locked rows in opposite orders, so PostgreSQL aborted one.

NameError: uninitialized constantRuby / Rails

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.

ArgumentError: wrong number of arguments (given 1, expected 2)Ruby / Rails

Ruby: ArgumentError: wrong number of arguments (given 1, expected 2..3)

A method was called with more or fewer arguments than it accepts.

ActiveRecord::ConnectionNotEstablishedRuby / Rails

Rails: ActiveRecord::ConnectionNotEstablished: No connection pool for 'ActiveRecord::Base' found

ActiveRecord has no database connection configured or established for this process.

ActiveRecord::AssociationTypeMismatchRuby / Rails

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.

Two steps away (25)

ActiveRecord::PendingMigrationErrorRuby / Rails

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.

ActionController::InvalidAuthenticityTokenRuby / Rails

Rails: ActionController::InvalidAuthenticityToken (Can't verify CSRF token authenticity)

A non-GET request arrived without a valid CSRF token for the session.

TypeError: no implicit conversion of nil into StringRuby / Rails

Ruby: TypeError: no implicit conversion of nil into String

A String method (`+`, `File.join`, `Array#join` usage) received `nil` instead of a string.

Bundler: Could not find gem in locally installed gemsRuby / Rails

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 could not find compatible versions for gemRuby / Rails

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.

FactoryBot::DuplicateDefinitionError: Factory already registeredRuby / Rails

FactoryBot: FactoryBot::DuplicateDefinitionError: Factory already registered: user

Two factory definitions use the same name (or files are loaded twice).

1146MySQL

MySQL ERROR 1146 (42S02): Table 'db.table' doesn't exist

The query references a table that MySQL can’t find in that database.

42P01PostgreSQL

PostgreSQL: ERROR: relation "x" does not exist

The table/view isn’t found — missing migration, wrong schema, or a case-sensitive quoted name.

1022MySQL

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.

You don't have write permissions for the /Library/Ruby/Gems directorymacOS

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.

TypeError: nil can't be coerced into IntegerRuby / Rails

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.

LoadError: cannot load such fileRuby / Rails

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.

ActiveRecord::RecordNotFound: Couldn't find X with 'id'=Ruby / Rails

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).

ActiveRecord::RecordInvalid: Validation failedRuby / Rails

Rails: ActiveRecord::RecordInvalid: Validation failed: Email can't be blank, Name is too short

`save!`/`create!`/`update!` raised because validations failed.

PG::UndefinedTable: relation does not existRuby / Rails

Rails: ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "users" does not exist

Rails queried a table that isn't in the connected PostgreSQL database.

Zeitwerk::NameError: expected file to define constantRuby / Rails

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.

Failed to build gem native extensionRuby / Rails

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.

Your Ruby version is X, but your Gemfile specified YRuby / Rails

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.

RSpec::Expectations::ExpectationNotMetError: expected X got YRuby / Rails

RSpec: expected: 200 got: 404 (compared using ==) — RSpec::Expectations::ExpectationNotMetError

An RSpec `expect` assertion didn't hold: the actual value differs from what the test expected.

Error: connect ECONNREFUSED 127.0.0.1:6379Redis

Redis: Error: connect ECONNREFUSED 127.0.0.1:6379 / Could not connect to Redis at 127.0.0.1:6379: Connection refused

Nothing is listening on the Redis host/port your client uses.

Redis TLS: SSL handshake error / protocol mismatchRedis

Redis: Error: write EPROTO ... SSL routines:ssl3_get_record:wrong version number / Connection reset by peer (TLS vs plaintext)

The client and server disagree about TLS — plaintext client to a TLS port, or TLS client to a plaintext port.

ECONNRESET / Connection reset by peer on idle Redis connectionRedis

Redis: Error: read ECONNRESET / redis.exceptions.ConnectionError: Connection reset by peer after idle time

A middlebox or Redis closed an idle connection, and the pooled client reused it.

Mysql2::Error: Unknown column in field listRuby / Rails

Rails: ActiveRecord::StatementInvalid: Mysql2::Error: Unknown column 'users.nickname' in 'field list'

The query references a column that doesn't exist in the table (missing migration, typo or stale schema cache).

ActiveRecord::RecordNotUnique: duplicate key valueRuby / Rails

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.

PG::ConnectionBad: could not connect to serverRuby / Rails

Rails: PG::ConnectionBad: could not connect to server: Connection refused. Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?

Rails can't reach PostgreSQL — the server is down, wrong host/port/socket, or credentials/pg_hba block it.