blob: 30a9c4ff8a7176413dd03151798fce205792eed5 [file] [log] [blame] [view]
## fi-0156: Cannot be optional {:#fi-0156}
This error occurs when you try to mark a type as optional that cannot be
optional.
{% include "docs/reference/fidl/language/error-catalog/label/_bad.md" %}
```fidl
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/bad/fi-0156.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
```
To fix this error, remove the optional constraint:
{% include "docs/reference/fidl/language/error-catalog/label/_good.md" %}
```fidl
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/good/fi-0156.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
```
Only FIDL types that can be made optional with no change to the wire shape are
allowed to use the `optional` constraint. See the
[optionality][0156-optionality] guide, or the expandable below, for more information.
[0156-optionality]: /docs/development/languages/fidl/examples/README.md#optionality
<<../../../../development/languages/fidl/widgets/_optionality.md>>