#1984·telegraf

Can't edit thumbnail as InputFile on editMessageMedia

Author: matteolungoCreated May 1, 2024Updated May 5, 2026

Context

  • Telegraf.js Version: 4.16.3
  • Node.js Version: 18.15.0
  • Operating System: Windows 11

Minimal Example Code Reproducing the Issue

typescript
reply = await ctx.editMessageMedia({
    type: 'audio', media: {
        source: fs.readFileSync(`${title}.mp3`),
        thumbnail: { source: fs.readFileSync('thumbnail.jpg') }
    }
})

Expected Behavior

The thumbnail is being edited

Current Behavior

The API returns the error below (I use the same syntax to attach thumbnail in sendAudio method and it's working correctly).

Error Message and Logs

Error: 400: Bad Request: can't parse InputMedia: Field "thumbnail" must be of type String