tryCatchInEffectGen

August 4, 2026 ยท View on GitHub

Discourages try/catch in Effect generators in favor of Effect error handling

PropertyValue
CategoryAnti-pattern
Default severitysuggestion
FixableNo
Effect versionsv3, v4
Diagnostic codesTS377012
Language Service nametryCatchInEffectGen
Oxlint nameeffecttsgo/try-catch-in-effect-gen

Preview

import * as Effect from "effect/Effect"

export const preview = Effect.gen(function*() {
  try { return yield* Effect.succeed(1) }
/**
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ effecttsgo(try-catch-in-effect-gen): This Effect generator contains `try/catch`; in this context, error handling is expressed with Effect APIs such as Effect.try, Effect.tryPromise, Effect.catch, Effect.catchTag).
*/
  catch { return 0 }
/**
^^^^^^^^^^^^^^^^^^^^
*/
})

Language Service Configuration

See the Language Service setup guide for installation instructions.

{
  "$schema": "./node_modules/@effect/tsgo/schema.json",
  "compilerOptions": {
    "plugins": [
      {
        "name": "@effect/language-service",
        "diagnosticSeverity": {
          "tryCatchInEffectGen": "warning"
        }
      }
    ]
  }
}

Oxlint Configuration

See the Oxlint setup guide for installation and patching instructions.

{
  "$schema": "./node_modules/@effect/tsgo/oxlint-schema.json",
  "options": {
    "typeAware": true
  },
  "plugins": ["effecttsgo"],
  "rules": {
    "effecttsgo/try-catch-in-effect-gen": "warn"
  }
}