Home / Docs / Diagnostics
U6005: A host value is not valid UTF-8
una run and native executables abort when a host operation would make a Text from bytes that are not valid UTF-8: the content Files.read reads, or the value Env.get reads (spec/14 §3, ADR 0086). The diagnostic points at the operation, and its message says which of the two it was.
Why Una rejects it
It is an abort, not a FileError or a None, because those bytes are internal. A failure or an Option tag that the program could branch on would tell a public branch whether an internal file or variable is valid UTF-8, one bit per operation (S-16). An abort ends the run, which is outside the noninterference model, as running out of depth or memory is (spec/07 §1).
How to fix it
The cause is the host's data, not the program, so there is no failing example to show here: no program text causes it, and no change to the program removes it. Store the file, or set the variable, as UTF-8, for example by converting a file in a legacy encoding with iconv -f latin1 -t utf-8.