# Conversion Error: The value is out of range for INT32

> A cast met a number the destination type cannot hold, for example 99999999999 cast to INTEGER.

Source: https://sqlly.app/errors/duckdb/conversion-out-of-range
Last updated: 2026-11-30
License: Text and data [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) (credit SQLly, sqlly.app); code and SQL snippets [MIT](https://opensource.org/license/mit). [Details](https://sqlly.app/license).
Note: Quoted error message text belongs to its database vendor.

- Exception: `Conversion Error`
- Category: Conversion and range errors

Error message:

```text
Conversion Error: Type INT64 with value 99999999999 can't be cast because the value is out of range for the destination type INT32
```

## What it means

A cast reached a value that fits the source type but not the destination: `99999999999` is a valid BIGINT, and casting it to INTEGER fails because INTEGER stops at 2147483647. The message names the physical types: `INT64` is BIGINT and `INT32` is INTEGER, so it tells you both the value and the type that refused it.

Keep this class apart from its neighbors. `Could not convert string 'abc' to INT32` means the value is the wrong kind, and `Out of Range Error: Overflow in multiplication of INT8` means arithmetic overflowed after the fact. Here the value exists, the cast is the right idea, and the destination type is too small.

## Common causes

- A literal or computed value wider than the column type, for example loading BIGINT counts into an INTEGER column.
- A CSV or Parquet import where the column was declared or inferred narrower than the data it holds.
- A DECIMAL(4,2) column receiving 100.00, which needs three digits before the decimal point.

## How to fix it

1. Count and inspect the values that will not fit before changing anything:

   ```sql
   SELECT count(*) FROM stage
   WHERE amount IS NOT NULL AND TRY_CAST(amount AS INTEGER) IS NULL;
   ```
2. Widen the column to the smallest type that holds the real range:

   ```sql
   ALTER TABLE measurements ALTER COLUMN amount TYPE BIGINT;
   ```
3. For imports, declare the type up front so the scan does not decide for you:

   ```sql
   SELECT * FROM read_csv('input.csv', types = {'amount': 'BIGINT'});
   ```
4. When out-of-range rows are expected, sort them out with TRY_CAST instead of failing the load:

   ```sql
   SELECT TRY_CAST(amount AS INTEGER) FROM stage;
   ```

## Reproduce it safely

```sql
SELECT 99999999999::INTEGER;   -- Conversion Error: Type INT64 with value 99999999999 can't be cast because the value is out of range for the destination type INT32
```

## Questions

### Why does the message say INT32 when my column is INTEGER?

DuckDB messages name physical types: INTEGER is INT32, BIGINT is INT64, TINYINT is INT8. Read INT32 as INTEGER.

### Can I get NULL instead of an error for bad values?

Use TRY_CAST: it returns NULL when the value does not fit, so you can filter or count the out-of-range rows instead of failing the statement.

## Related errors

- [`Conversion Error`](https://sqlly.app/errors/duckdb/conversion-could-not-convert): The value cannot be cast to the target type
- [`Conversion Error`](https://sqlly.app/errors/duckdb/conversion-invalid-date): The date or timestamp string is malformed
- [`22003`](https://sqlly.app/errors/postgresql/22003): PostgreSQL: numeric value out of range

The code and message text are from the [DuckDB documentation](https://duckdb.org/docs/).
