globalErrorInEffectCatch

August 4, 2026 ยท View on GitHub

Warns when catch callbacks return global Error type instead of typed errors

PropertyValue
CategoryAnti-pattern
Default severitywarning
FixableNo
Effect versionsv3, v4
Diagnostic codesTS377022
Language Service nameglobalErrorInEffectCatch
Oxlint nameeffecttsgo/global-error-in-effect-catch

Preview

import { Effect } from "effect"

export const preview = Effect.tryPromise({
/**
                       ^^^^^^^^^^^^^^^^^ effecttsgo(global-error-in-effect-catch): The `catch` callback in `Effect.tryPromise` returns the global `Error` type. Untagged errors merge together in the Effect error channel and lose type-level distinction; a tagged error preserves that distinction and can wrap the original error in a `cause` property.
*/
  try: async () => 1,
  catch: (error) => new Error(String(error))
})

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": {
          "globalErrorInEffectCatch": "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/global-error-in-effect-catch": "warn"
  }
}