← 报错百科

AsyncFiberException · Fiber · FiberFailure

这是线索,不是结论。 内容由机器从检索到的中文译文合成,尚未经人确认;引用是提问那一刻的快照, 译文更新后可能过时。每条都附了可点回原文的链接 —— 请核对后再采用。 发现不对请 提 issue

报错原文

[AsyncFiberException: Fiber #0 cannot be resolved synchronously. This is caused by using runSync on an effect that performs async work] {
  name: '(FiberFailure) AsyncFiberException',
  Symbol(effect/Runtime/FiberFailure): Symbol(effect/Runtime/FiberFailure),
  Symbol(effect/Runtime/FiberFailure/Cause): {
    _tag: 'Die',
    defect: [Fiber #0 cannot be resolved synchronously. This is caused by using runSync on an effect that performs async work] {
      fiber: FiberRuntime {
        _fiberRefs: FiberRefsImpl {
          locals: Map(2) { [Object] => [Array], [Object] => [Array] },
          Symbol(effect/FiberRefs): Symbol(effect/FiberRefs)
        },
        _fiberId: Runtime {
          id: 0,
          startTimeMillis: 1789271277101,
          _tag: 'Runtime',
          Symbol(effect/FiberId): Symbol(effect/FiberId)
        },
        _queue: [],
        _children: null,
        _observers: [],
        _running: false,
        _stack: [],
        _asyncInterruptor: null,
        _asyncBlockingOn: null,
        _exitValue: EffectPrimitiveSuccess {
          _op: 'Success',
          effect_instruction_i0: 1,
          effect_instruction_i1: undefined,
          effect_instruction_i2: undefined,
          trace: undefined,
          _tag: 'Success',
          Symbol(effect/Effect): {
            _R: [Function: _R],
            _E: [Function: _E],
            _A: [Function: _A],
            _V: '3.22.2'
          }
        },
        _steps: [],
        _isYielding: false,
        currentRuntimeFlags: 53,
        currentOpCount: 1,
        currentSupervisor: Const {
          effect: EffectPrimitiveSuccess {
            _op: 'Success',
            effect_instruction_i0: undefined,
            effect_instruction_i1: undefined,
            effect_instruction_i2: undefined,
            trace: undefined,
            _tag: 'Success',
            Symbol(effect/Effect): [Object]
          },
          Symbol(effect/Supervisor): { _T: [Function: _T] }
        },
        cur

诊断

根据文档,`runSync` 只能同步执行 Effect,当目标 Effect 内部包含异步工作时就无法同步求值,于是抛出 `AsyncFiberException`(对应 `effect/Cause/AsyncFiberException`)。 修复方向:不要用 `runSync` 运行含异步工作的 Effect,改用 Effect 模块中其他能等待异步完成的 `run` 函数。 若不确定是哪段 Effect 触发了异步,请提供最小复现代码。

依据(3 条站内译文)

你也被这个报错卡住了?

你自己的报错整段贴到报错诊断 —— 它提取的 API 名与类型名来自你的实际代码,比照抄别人的诊断更准; 诊断完也会并进这一条(同一报错算同一条)。

本页来自 2026-09-13 的快照(https://effect-ts.cn)。来自站内 /debug 的真实诊断,按报错签名归并(绝对路径/行列号/堆栈帧已归一)。条目为机器生成、未经人审(reviewed 字段),引用是提问那一刻的快照。