Bicep diagnostic code - BCP226

Bicep diagnostic code BCP226 occurs when a Bicep file contains a #disable-next-line directive but doesn't specify any diagnostic codes after the directive.

The #disable-next-line directive requires at least one diagnostic code to indicate which compiler diagnostics to suppress for the following line. If you use the directive without any codes, the compiler can't determine which diagnostics to disable and reports BCP226.

Description

Expected at least one diagnostic code at this location. Valid format is #disable-next-line diagnosticCode1 diagnosticCode2 ...

Level

Error

Solution

Add at least one diagnostic code.

Examples

The following example raises the diagnostic because it doesn't specify any diagnostic codes after the directive.

#disable-next-line 
resource stg 'Microsoft.Storage/storageAccounts@2025-06-01' = {
  name: 'mystorage'
}

You can fix the diagnostic by adding one or more diagnostic codes. List multiple codes separated by spaces.

#disable-next-line BCP035
resource stg 'Microsoft.Storage/storageAccounts@2025-06-01' = {
  name: 'mystorage'
}

Next steps

For more information about Bicep diagnostics, see Bicep core diagnostics.