Bicep error code - BCP124

This error occurs when you specify a decorator that isn't supported by the type of the syntax being decorated.

Error description

The decorator <decorator-name> can only be attached to targets of type <data-type>, but the target has type <data-type>.

Solutions

Use the valid decorators based on the data types.

Examples

The following example raises the error because @maxValue() is for the integer data type, not for the string data type.

@maxValue(3)
param name string 

You can fix the error by providing the correct decorator for the data type:

@maxLength(3)
param name string 

For a list of decorators, see Decorators.

Next steps

For more information about Bicep error and warning codes, see Bicep core diagnostics.