Docs menu

E197: An empty recover block

What compiler warning E197 means, and how to fix it.

A warning, on by default. Since TurfLang 2.3.

recover ... run { } handles a failure. An empty block handles nothing: the error is dropped without a trace, which is what recover exists to prevent.

Example
import fs;fn main(): int {    fs::mkdir("out") recover as err run {    };                      // the error is dropped -- WARNING    return 0;}

Handle the error in the block: report it, return it, or use a default:

Example
import fs;fn main(): int {    fs::mkdir("out") recover as err run {        printline("could not create out/");    };    return 0;}

If ignoring the error is right, put a comment in the block saying why. A block holding a comment does not warn:

Example
    fs::mkdir("out") recover as err run {        // the directory may exist already, which is fine    };

This is a warning, not an error – compilation still succeeds. To silence it for a whole build, set its lint level to allow: turf build --allow E197 (or [lints] E197 = "allow" in turf.toml).

Run turf --explain E197 in a terminal to read this again.

Last updated: Oct 15, 2026Edit this page on GitHub

Esc

Type to search.