danny-avila/LibreChat · error · Error

No download stream method found for source: ${source}

Error message

No download stream method found for source: ${source}

What it means

Thrown when the resolved `source` is valid enough to call getStrategyFunctions, but the returned strategy object has no `getDownloadStream`. Looking at api/server/services/Files/strategies.js, some strategies legitimately expose getDownloadStream: null (e.g., document_parser, mistral_ocr variants). The tool requires a streamable source to attach the image to the multipart edit request, so a non-streaming strategy is a hard error here.

Source

Thrown at api/app/clients/tools/structured/OpenAIImageTools.js:313

        if (!imageFile) {
          continue;
        }
        /** @type {NodeStream<File>} */
        let stream;
        /** @type {NodeStreamDownloader<File>} */
        let getDownloadStream;
        const source = imageFile.source || appFileStrategy;
        if (!source) {
          throw new Error('No source found for image file');
        }
        if (streamMethods[source]) {
          getDownloadStream = streamMethods[source];
        } else {
          ({ getDownloadStream } = getStrategyFunctions(source));
          streamMethods[source] = getDownloadStream;
        }
        if (!getDownloadStream) {
          throw new Error(`No download stream method found for source: ${source}`);
        }
        stream = await getDownloadStream(req, imageFile.filepath);
        if (!stream) {
          throw new Error('Failed to get download stream for image file');
        }
        formData.append('image[]', stream, {
          filename: imageFile.filename,
          contentType: imageFile.type,
        });
      }

      /** @type {import('axios').RawAxiosHeaders} */
      let headers = {
        ...formData.getHeaders(),
      };

      if (process.env.IMAGE_GEN_OAI_AZURE_API_VERSION && process.env.IMAGE_GEN_OAI_BASEURL) {
        headers['api-key'] = apiKey;

View on GitHub (pinned to 5ff282f900)

Solutions

  1. Confirm the attached file's `source` is an image-capable storage (local, s3, firebase, azure_blob, openai) that implements getDownloadStream.
  2. Filter image_ids in the edit tool to files whose source supports streaming before invoking.
  3. If you added a custom FileSources value, implement getDownloadStream in its strategy.
  4. Reject non-image files at the request boundary with a clearer error than the generic one.

Example fix

// before — file.source = 'document_parser' (getDownloadStream: null)
await imageEditTool.invoke({ prompt: '...', image_ids: ['file-doc'] });

// after — only pass image-capable files
const imageSources = ['local', 's3', 'firebase', 'azure_blob', 'openai'];
const editable = files.filter(f => imageSources.includes(f.source));
await imageEditTool.invoke({
  prompt: '...',
  image_ids: editable.map(f => f.file_id),
});
Defensive patterns

Strategy: type-guard

Validate before calling

const STREAMABLE_SOURCES = ['local', 's3', 'firebase', 'azure_blob', 'openai', 'cloudfront'];
function filterStreamableFiles(files) {
  return files.filter(f => STREAMABLE_SOURCES.includes(f.source));
}

Type guard

function isStreamableSource(source) {
  return ['local', 's3', 'firebase', 'azure_blob', 'openai', 'cloudfront'].includes(source);
}

Try / catch

try {
  await imageEditTool.invoke(args);
} catch (e) {
  if (/No download stream method found for source/.test(e.message)) return 'That file type cannot be streamed for editing.';
  throw e;
}

Prevention

When it happens

Trigger: Editing an image whose source maps to a strategy that does not support streaming — e.g., document_parser, vectordb, or a mistral_ocr source — where getStrategyFunctions returns { getDownloadStream: null } or omits the method.

Common situations: User attached a document/OCR-parsed file (source=document_parser) to an image-edit request; a file was mislabeled with a non-image source during upload; a new FileSources value was added without a getDownloadStream implementation; routing a non-image file into the image edit tool.

Related errors


AI-assisted analysis of danny-avila/LibreChat@5ff282f900 (2026-08-12). Data as JSON: /api/errors/7551dfd28aae2b3e. Report an issue: GitHub.