Source: https://mokxi.com/errors/expected-primary-expression
Updated: 2026-11-16

Home / Errors
Arduino build error

# error: expected primary-expression before ')' token

The compiler needed a value, a name or a number, and found a bracket, a comma or a keyword instead.

Try the fixed sketch in Mokxi See the causes

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

The message

## What the Arduino IDE prints

Output window

It happens when an operand is missing, when a type is written inside a call, or when a variable is left out of a condition.

Mokxi's compiler, clang, words it as expected expression.

Causes

## The 3 usual causes with the fix

### 1A value is missing next to an operator

A comparison or a sum needs something on both sides. An empty side leaves the compiler with nothing to read.

Broken

Fixed

Mokxi’s build tab says: Something is missing here: a value, a bracket or a name

Try this fix in Mokxi

### 2A type is written inside a function call

A call takes values, not declarations. int 13 in the brackets is a type where a number belongs.

Broken

Fixed

Try this fix in Mokxi

### 3A comma with nothing before it

A stray or doubled comma leaves an argument empty.

Broken

Fixed

Try this fix in Mokxi

FAQ

## Questions and answers

### What is a primary-expression?

The smallest piece of a calculation: a name, a number or a bracketed expression. The compiler found something else where one was needed.

### Why does it say before a token?

The token named is the first thing the compiler could not use. The missing value sits just before it.

### Is this the same as a missing semicolon?

No. A missing semicolon gives "expected ';'". This error means a value is missing inside a statement.

Next

## More errors and the longer guide

- error: expected ';' before '}' token
- error: expected unqualified-id before 'if'

The longer guide to this error All Arduino errors
