toeverything/AFFiNE · error · Error

action_bridge_stream_error

action_bridge_stream_error

Error message

Action image generation produced no image

What it means

During an AI action, the bridge streams the configured image model and collects yielded images; if the stream completes without producing any image it throws Error('Action image generation produced no image'), surfaced under code `action_bridge_stream_error`. The provider round-trip finished but returned zero images.

Source

Thrown at packages/backend/server/src/plugins/copilot/runtime/action-runtime-bridge.ts:131

        step.slot
      );
      return { result: output.value, attachments: [] };
    }
    const images = [];
    for await (const image of this.runtime.streamImageArtifacts(
      { profileId: step.profileId, modelId: step.modelId },
      step.messages,
      {
        ...(step.options as CopilotImageOptions | undefined),
        builtInRouteId: step.builtInRouteId,
      },
      undefined,
      step.slot
    )) {
      images.push(image);
    }
    const result = images[0];
    if (!result) throw new Error('Action image generation produced no image');
    return { result, attachments: [result] };
  }

  private async projectAssistantResult(
    input: ActionRuntimeBridgeInput,
    result: unknown,
    artifacts: unknown[],
    wasAborted: boolean
  ) {
    if (!input.session) return null;
    const turn = projectActionResultToAssistantTurn({
      session: input.session,
      actionId: input.actionId,
      result,
      artifacts,
      wasAborted,
    });
    if (!turn) return null;

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Retry the action — transient empty generations from image providers are common
  2. Confirm the selected model/route actually supports image generation (check model capabilities and builtInRouteId)
  3. Adjust the image prompt to avoid content likely filtered by provider moderation
  4. Check the provider dashboard/logs for refused or empty completions at that timestamp
Defensive patterns

Strategy: retry

Validate before calling

// guard: confirm the route/model is image-capable before running the action
const caps = await fetchModelCapabilities(step.modelId);
if (!caps.includes('image_generation')) {
  throw new Error('selected model cannot generate images — pick an image route');
}

Type guard

function isActionStreamError(e: unknown): boolean {
  return (e as { extensions?: { code?: string } })?.extensions?.code === 'action_bridge_stream_error' ||
    /produced no image/.test((e as Error)?.message ?? '');
}

Try / catch

try {
  return await runImageAction(step);
} catch (e) {
  if (isActionStreamError(e)) {
    await sleep(1000);
    return runImageAction(step); // empty generations are often transient
  }
  throw e;
}

Prevention

When it happens

Trigger: The image model returns empty content: safety/moderation refusal, provider hiccup, a route/model that is not actually image-capable for the request shape, or options causing the model to emit nothing for the slot.

Common situations: Switching the image route to a model without real image output; prompts that trip provider content filters; free-tier providers intermittently returning empty completions; misconfigured builtInRouteId resolving to a text model.

Related errors


AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18). Data as JSON: /api/errors/87c3a8587fe33240. Report an issue: GitHub.