# Rails: ArgumentError: Missing encryption key to decrypt file with. Ask your team for your master key and write it to config/master.key or put it in the ENV['RAILS_MASTER_KEY']

**Code:** `Missing encryption key to decrypt file with` · **Category:** Ruby / Rails · **Seen on:** Ruby, Docker

Rails needs `config/master.key` or `RAILS_MASTER_KEY` to read credentials, and neither exists.

## Meaning

`master.key` isn't committed (by design). Provide it via the environment variable in production/CI (`RAILS_MASTER_KEY=...`) or place the file in `config/` on the server. For Docker builds pass it as a secret, or use `SECRET_KEY_BASE_DUMMY=1` for `assets:precompile` (Rails 7.1).

## Common causes

- `config/master.key` missing (not in git)
- `RAILS_MASTER_KEY` unset on the server/CI
- Docker build without the key
- Precompiling assets without credentials
- New developer without the key

## Quick fix

1. Set `RAILS_MASTER_KEY` in the environment/secrets manager
2. For precompile: `SECRET_KEY_BASE_DUMMY=1 bin/rails assets:precompile`
3. Share the key securely with teammates

## Detailed fix by platform

### Docker

1. `docker run -e RAILS_MASTER_KEY=$(cat config/master.key) app`

## How to diagnose

1. **Key** — File or ENV?
2. **Environment** — Prod/CI?
3. **Build** — Dummy key?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/ruby/rails-master-key-missing)
