Skip to content
Latchkey

C# "CS1003: Syntax error, X expected" in CI

CS1003 reports that the parser was looking for a particular token - a comma, a closing brace, an angle bracket - and the next token did not match. It is a structural typo: a missing separator, an extra token, or a mismatched bracket.

What this error means

The build fails with CS1003 naming the token it expected. It is fully deterministic.

dotnet
Dto.cs(18,40): error CS1003: Syntax error, ',' expected

Common causes

A missing or extra separator

A comma between arguments or generic type parameters is missing, or an extra one was left behind after a refactor.

A mismatched bracket or generic angle

An unbalanced <>, (), or {} makes the parser expect a different token than what appears.

How to fix it

Fix the token at the reported position

  1. Open the line and column from the error and add or remove the expected token.
  2. Verify generic type argument lists and method signatures are balanced.
  3. Rebuild.

How to prevent it

  • Rely on editor bracket matching and format-on-save.
  • Keep PRs small so syntax slips are caught in review.

Frequently asked questions

What causes ""CS1003: Syntax error""?
A comma between arguments or generic type parameters is missing, or an extra one was left behind after a refactor.
How do I fix "CS1003: Syntax error"?
Fix the token at the reported position

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card