AUR0816

Error Message

AUR0816: Invalid [default-case] usage. Multiple 'default-case's are not allowed.

Description

This error occurs during template compilation/linking when an element using the switch attribute has more than one direct child element marked with the default-case attribute.

Cause

The switch controller allows for multiple case attributes, each matching a specific value. However, it permits only zero or one default-case attribute to handle scenarios where none of the specific case values match the value bound to switch. This error indicates that you have provided more than one default-case within the same switch block.

Solution

Ensure that within any given switch block, there is at most one element marked with the default-case attribute.

  1. Remove Extra default-case: Review the children of the switch element and remove all but one default-case attribute.

  2. Combine Logic: If you need complex default logic, place it within a single default-case element or <template default-case>.

  3. Use case Instead: If a condition was mistakenly marked as default-case, change it to a specific case="someValue" if appropriate.

Example

Debugging Tips

  • Carefully review all direct children of the element with the switch attribute.

  • Count the number of children that have the default-case attribute; ensure the count is 0 or 1.

  • Check for typos that might have accidentally resulted in multiple default-case attributes (e.g., copy-paste errors).

Last updated

Was this helpful?