> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sifr.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# SIFR-IO-0802: Open mode must be statically known.

> Open mode must be statically known.

`SIFR-IO-0802` belongs to the **File and stream I/O** diagnostic family. It means: open mode must be statically known.

## Why It Happens

Sifr makes file mode and text encoding boundaries explicit. This diagnostic fires when file I/O would cross those boundaries unsafely or ambiguously.

<Info>
  Use `sifr --explain SIFR-IO-0802` locally to see the renderer's exact message template and any machine-applicable suggestions for the compiler version you are running.
</Info>

## Erroneous Code

```python theme={null}
from sifr.io import open

file = open("notes.txt", "r")
```

## How To Fix It

Make file modes and encodings explicit at compile time, especially at text/binary boundaries.

## Fixed Code

```python theme={null}
from sifr.io import open_text

file = open_text("notes.txt", encoding="utf-8")
```

## Details

| Field                  | Value                                                         |
| ---------------------- | ------------------------------------------------------------- |
| Code                   | `SIFR-IO-0802`                                                |
| Family                 | `IO`                                                          |
| Severity               | Error                                                         |
| Stability              | stable                                                        |
| Owner                  | `sifr_lowering::lower::expressions::call_shadowable_builtins` |
| Representative fixture | `crates/sifr/tests/e2e/fail/text_i18n_open_dynamic_mode.sifr` |

See the [Error Codes index](/diagnostics/error-codes) for the complete catalog.
