soma.cell

E0115: io

E0115 io — a file the command was given cannot be read.

A compile-time error of soma check, the checker of the Soma programming language (soma explain E0115).

The rule

soma check reads a program as UTF-8 text; when the file cannot be read (a missing path, or here a file saved in Latin-1, whose é is not valid UTF-8), it stops with "cannot read" and the JSON report (soma check --json) gives the code E0115. The plain-text output shows the message without the code, and the JSON fix field says "check the path" even when the path is right and the encoding is the problem. Save the file as UTF-8 (iconv -f ISO-8859-1 -t UTF-8); a UTF-8 byte-order mark at the start is accepted.

A program that triggers it

wrong.cell

// Menu prices for the Caf� du Port, in cents
cell Menu {
    face {
        signal price(item: String) -> Int
    }
    on price(item: String) {
        return match item {
            "cr�me br�l�e" -> 750
            "caf�" -> 250
            _ -> 0
        }
    }
}

What soma check prints:

$ soma check wrong.cell
error: cannot read 'wrong.cell': stream did not contain valid UTF-8

On line 1, // Menu prices for the Caf� du Port, in cents becomes // Menu prices for the Café du Port, in cents; lines 8–9 are rewritten.

wrong.cell → right.cell

--- wrong.cell
+++ right.cell
@@ -1,3 +1,3 @@
-// Menu prices for the Caf� du Port, in cents
+// Menu prices for the Café du Port, in cents
 cell Menu {
     face {
@@ -6,6 +6,6 @@
     on price(item: String) {
         return match item {
-            "cr�me br�l�e" -> 750
-            "caf�" -> 250
+            "crème brûlée" -> 750
+            "café" -> 250
             _ -> 0
         }

With the fix, soma check accepts the program:

$ soma check right.cell
✓ All checks passed.