Images randomly not loading

I have a code to log removed images. However, sometimes the image is displayed correctly, and sometimes it's just not showing in the embed.
Here's my code:
for (const attachment of attachments) {
  const fileType = attachment.contentType.split('/')[0];

  if (fileType == 'image') {
    const newAttachment = new AttachmentBuilder(attachment.url, { name: attachment.name });

    const imageEmbed = new EmbedBuilder()
      .setColor('ff2a2a')
      .setImage(`attachment://${newAttachment.name}`)

    logChannel.send({ embeds: [imageEmbed], files: [newAttachment] });
  }
}
Was this page helpful?