This error happens when you define an enum member whose value clashes with the reserved unknown value.
Flexible enums may hold values not known by the FIDL schema. In addition, flexible enums always reserve some value which will be treated as unknown. By default, that value is the maximum numerical value representable by the underlying integer type of that enum (e.g. 255
in case of uint8
).
{% include “docs/reference/fidl/language/error-catalog/label/_bad.md” %}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/bad/fi-0068.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
To fix the error, you may remove the member or change its value:
{% include “docs/reference/fidl/language/error-catalog/label/_good.md” %}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/good/fi-0068-a.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/good/fi-0068-b.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
Finally, if you come across this error when transitioning a strict
enum to a flexible
enum, you may use the @unknown
attribute to designate the numerical value of a particular member as the unknown value. See @unknown
.