Bicep diagnostic code - BCP311
This diagnostic occurs when you provide an invalid index number. Arrays in Bicep are zero-based. For more information, see Arrays.
Description
The provided index value of <index-value> isn't valid for type <type-name>. Indexes for this type must be between 0 and <zero-based-tuple-index>.
Level
Error
Solutions
Use the correct index number.
Examples
The following example raises the diagnostic because the index is out of bounds:
var exampleArray = [
1
2
3
]
output bar int = exampleArray[3]
You can fix the diagnostic by using the correct index number:
var exampleArray = [
1
2
3
]
output bar int = exampleArray[2]
Next steps
For more information about Bicep diagnostics, see Bicep core diagnostics.