Mintplex-Labs/anything-llm · error

Image edit returned no image data.

Error message

Image edit returned no image data.

What it means

The /v1/images/edits call returned 2xx, but payload.data[0] contained neither b64_json nor url — the only two response shapes editImage() understands. The provider 'succeeded' without returning an image, meaning its response envelope is not OpenAI-compatible or the image field is genuinely absent.

Solutions

  1. Log the raw response body before parsing to see what the provider actually returned.
  2. Fix or configure the provider to return OpenAI's shape: data[0].b64_json or data[0].url.
  3. If the provider cannot comply, switch to a different image engine for edits.
  4. Check the provider's own logs to confirm an image was really generated.
Defensive patterns

Strategy: try-catch

Type guard

function isUsableImageEditPayload(payload) {
  const image = payload?.data?.[0];
  return Boolean(
    image &&
      ((typeof image.b64_json === "string" && image.b64_json.length > 0) ||
        (typeof image.url === "string" && image.url.length > 0))
  );
}

Try / catch

try {
  const image = await generator.editImage({ prompt, images, size, signal });
} catch (err) {
  if (err.message === "Image edit returned no image data.") {
    // provider 2xx'd without an OpenAI-shaped body:
    // log the raw exchange and verify the provider's response schema
  } else {
    throw err;
  }
}

Prevention

When it happens

Trigger: An OpenAI-compatible server that returns a different envelope (image nested elsewhere, base64 under a different key, or an empty data array); a provider returning an error body with HTTP 200; a proxy rewriting the response body; a model that returns metadata/text instead of image data.

Common situations: Self-hosted OpenAI-compatible image servers (comfyui bridges, local gateways) with nonstandard schemas; providers that change their response format between versions.

Understand the failure class

Background: "empty response", "returned no data", "empty embeddings": what HTTP 200-with-empty-body errors mean across libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@f92433b4ea (2026-08-18). Data as JSON: /api/errors/972973f6d083f24c. Report an issue: GitHub.

Appendix: source

Thrown at server/utils/ImageGenerators/base.js:106

    if (!res.ok) {
      const body = await res.text().catch(() => "");
      throw new Error(
        `Image edit failed (${res.status}): ${body || res.statusText}`
      );
    }

    const payload = await res.json();
    const image = payload?.data?.[0];
    let result;
    if (image?.b64_json) {
      result = { buffer: Buffer.from(image.b64_json, "base64") };
    } else if (image?.url) {
      const imgRes = await fetch(image.url, { signal: signal ?? null });
      if (!imgRes.ok)
        throw new Error(`Failed to fetch edited image: ${imgRes.status}`);
      result = { buffer: Buffer.from(await imgRes.arrayBuffer()) };
    } else {
      throw new Error("Image edit returned no image data.");
    }
    this._sendImageTelemetry("image_generated", {
      withReferences: images.length > 0,
    });
    return result;
  }

  /**
   * Emits a telemetry event if Telemetry is turned on.
   * @param {string} event
   * @param {Object} [additionalOpts]
   */
  _sendImageTelemetry(event, additionalOpts = {}) {
    const { Telemetry } = require("../../models/telemetry");
    Telemetry.sendTelemetry(event, {
      ...additionalOpts,
      provider: this.className,
      model: this.model,

View on GitHub (pinned to f92433b4ea)