Skip to content
Latchkey

ReScript "Syntax error!" in CI

ReScript's parser reached a token it could not fit into the grammar. "Syntax error!" prints the file, the location, and what it expected, and the build halts before any type checking.

What this error means

rescript build fails with "Syntax error!" plus a caret range and an "I'm expecting ..." hint at the offending construct.

ReScript
  Syntax error!
  /src/App.res:4:3-4:3

  3 | let total = items
  4 | ->reduce(+, 0
  5 | }

  I'm expecting a ")" here

Common causes

A missing or unbalanced delimiter

An unclosed parenthesis, brace, or bracket leaves the parser expecting a token it never finds.

Legacy or invalid syntax

A construct from an older syntax version or an invalid expression form is not accepted by the current parser.

How to fix it

Close the delimiter the parser names

  1. Go to the location and read the "I'm expecting ..." hint.
  2. Add the missing delimiter or correct the construct.
  3. Re-run rescript build.
src/App.res
let total = items->reduce((+), 0)

Format to localize the break

Run the formatter; it fails at the same spot and often makes an unbalanced delimiter obvious.

Terminal
npx rescript format -all

How to prevent it

  • Let an editor or rescript format catch unbalanced delimiters as you write.
  • Build locally before pushing so syntax errors do not reach CI.
  • Migrate legacy syntax with the official upgrade tooling.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →