Source: https://mokxi.com/errors/too-many-initializers
Updated: 2026-11-16

Home / Errors
Arduino build error

# error: too many initializers for 'int [3]'

The array was declared with room for a number of items and the braces hold more. Text arrays have the same limit, and the text needs one extra place for its end mark.

Try the fixed sketch in Mokxi See the causes

- Build error
- 2 common causes
- Seen 487 times in failed builds on Mokxi in the 30 days to November 16, 2026.

The message

## What the Arduino IDE prints

Output window

Make the array bigger, or let the compiler count: leave the size out.

Mokxi's compiler, clang, words it as excess elements in array initializer.

Causes

## The 2 usual causes with the fix

### 1More values than the declared size

int values[3] holds three items. Declare room for all of them, or write int values[] and let the compiler count.

Broken

Fixed

Try this fix in Mokxi

### 2A text longer than its char array

A char array needs one place per letter plus one for the zero that ends the text. "Mokxi" needs six.

Broken

Fixed

Mokxi’s build tab says: The text is longer than its char array.

Try this fix in Mokxi

FAQ

## Questions and answers

### Why does text need one extra place?

C text ends with a zero byte that marks the end. Without room for it, the printing code would run past the end.

### Can I leave the size out?

Yes, when you give the values, as in int values[] = {1, 2, 3}. The compiler counts them.

### Is giving fewer values an error?

No. The rest are set to zero.

Next

## More errors and the longer guide

- error: invalid types 'int[int]' for array subscript
- Global variables use 2400 bytes (117%) of dynamic memory

Every Arduino compile error All Arduino errors
