# `AshVault.Errors.KeySizeMismatch`
[🔗](https://github.com/jakeschurch/ash_vault/blob/main/lib/ash_vault/errors.ex#L105)

Raised when the key material a provider supplies is not the size the cipher requires.

This is a **configuration** fault — a `key_bytes:` that disagrees with the cipher, an
OpenBao `key_type:` of `aes128-gcm96` under a 256-bit cipher, a truncated key file.
It is deliberately neither `AshVault.Errors.CiphertextIntegrityFailed` (which would tell
an operator their data had been tampered with) nor
`AshVault.Errors.ProviderUnavailable` (which would tell them to retry a permanent
misconfiguration forever). Fix the configuration; retrying cannot help.

# `exception`

```elixir
@spec exception(opts :: Keyword.t()) :: %AshVault.Errors.KeySizeMismatch{
  __exception__: true,
  actual: term(),
  bread_crumbs: term(),
  cipher: term(),
  class: term(),
  expected: term(),
  path: term(),
  provider: term(),
  splode: term(),
  stacktrace: term(),
  vars: term()
}
```

Create an `Elixir.AshVault.Errors.KeySizeMismatch` without raising it.

## Keys

- :provider
- :cipher
- :expected
- :actual

---

*Consult [api-reference.md](api-reference.md) for complete listing*
