| title | BCP124 |
|---|---|
| description | The decorator <decorator-name> can only be attached to targets of type <data-type>, but the target has type <data-type>. |
| ms.topic | reference |
| ms.custom | devx-track-bicep |
| ms.date | 10/30/2025 |
This diagnostic occurs when you specify a decorator that isn't supported by the type of the syntax being decorated.
The decorator <decorator-name> can only be attached to targets of type <data-type>, but the target has type <data-type>.
Error
Use the valid decorators based on the data types.
The following example raises the diagnostic because @maxValue() is for the integer data type, not for the string data type.
@maxValue(3)
param name string You can fix the diagnostic by providing the correct decorator for the data type:
@maxLength(3)
param name string For a list of decorators, see Decorators.
For more information about Bicep diagnostics, see Bicep core diagnostics.