Skip to content
Fallow home
All docs pages

Docs home

Unused tagged errors

What an unused-tagged-error finding of fallow dead-code means, why it matters and how to fix it.

What it reports

An Effect tagged error class is referenced only as a type or a catchTag string, and no code constructs or fails with it.

Dead code explains how fallow finds it.

Why it matters

Types and catchTag handlers plan for a failure that no code produces. The handlers are dead code, and readers think that the failure can occur.

Example

errors.ts declares class Expired extends Data.TaggedError("Expired"), signatures list it in the error channel and a handler calls catchTag("Expired"), but no code constructs Expired or fails with it.

Fix

Fail with the error where the condition occurs, or remove the class, its type references and its catchTag handlers. If consumers outside the project construct or decode it, suppress the line with // fallow-ignore-next-line unused-tagged-error.

Facts

FactValue
Issue typeunused-tagged-error
Rule id in SARIF outputfallow/unused-tagged-error
Commandfallow dead-code
Default severitywarn
Config key in rulesunused-tagged-errors
Filter option--unused-tagged-errors
Suppression comment// fallow-ignore-next-line unused-tagged-error
Fixable with fallow fixNo
Opt-inNo