# ArgumentError: wrong number of arguments in CI

> Fix "ArgumentError: wrong number of arguments (given N, expected M)" in Ruby CI - a method was called with the wrong arity, often after a gem upgrade changed a signature.

Source: https://latchkey.dev/learn/ruby/ruby-argumenterror-wrong-number-of-arguments-in-ci  
Updated: 2026-06-26

A method received a different number of arguments than its definition accepts. In CI this commonly appears after a dependency upgrade changed a method signature that your code still calls the old way.

## Diagnose it: Ruby version and platform

Bundler resolves against the Ruby version and the platform recorded in the lockfile. A runner on a different Ruby or a Linux platform missing from `Gemfile.lock` fails in a way that names a gem rather than the cause.

```Terminal
ruby -v && bundle -v
cat .ruby-version 2>/dev/null
bundle platform

# the usual CI-only failure: Linux platform absent from the lockfile
bundle lock --add-platform x86_64-linux
bundle install --jobs 4 --retry 3
```

> A gem that installs on macOS and fails on a Linux runner is usually a missing platform in `Gemfile.lock`, not a broken gem. Add the platform and commit the lockfile.

## FAQ

### What causes ArgumentError: wrong number of arguments in CI?

There are 3 common causes: gem signature changed, keyword vs positional in ruby 3, and stale method definition. An upgraded gem changed a method to take keyword arguments or fewer positional ones, but your call still passes the old positional list.

### How do I fix ArgumentError: wrong number of arguments in CI?

There are 2 fixes depending on which cause you have: match the call to the current signature and check the installed gem version. Work through them in order, since the first is the most common.

### What does ArgumentError: wrong number of arguments in CI actually mean?

A test or boot fails with ArgumentError stating given vs expected counts.

### How do I stop ArgumentError: wrong number of arguments in CI happening again?

Read upgrade changelogs for signature changes before bumping gems. The prevention section lists 3 changes that keep it from recurring.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
