Azure Bicep "Error BCP018: expected ... character" in CI
BCP018 is a Bicep parser error: it expected a specific token (a brace, colon, or keyword) at a location and found something else. The file fails to compile, so no deployment is attempted.
What this error means
az deployment or bicep build fails with "Error BCP018: Expected the \"}\" character at this location" (or another character), pointing at a line and column.
main.bicep(24,3) : Error BCP018: Expected the "}" character at this location.Common causes
A missing or extra delimiter
An unclosed object, a missing colon in a property, or a stray comma breaks the grammar at the reported line.
A typo in a keyword or declaration
A misspelled resource/param keyword or malformed decorator confuses the parser into expecting a different token.
How to fix it
Build locally to find the line
- Run
az bicep build --file main.bicep(orbicep build) to reproduce the exact line and column. - Fix the missing brace, colon, or keyword at that location.
- Rebuild until BCP018 clears, then deploy.
az bicep build --file main.bicepLint Bicep in CI before deploy
Add a build/lint step so syntax errors fail fast in a pre-deploy job rather than during the Azure deployment.
- run: az bicep build --file main.bicepHow to prevent it
- Run
az bicep buildas a CI lint step before deploy. - Use the Bicep editor extension to catch BCP errors while editing.
- Keep modules small so syntax errors are easy to locate.