I’m having trouble launching my Discord bot and keep running into this SSL certificate error:
ClientConnectorCertificateError: Cannot connect to host discord.com:443 ssl:True
[SSLCertVerificationError: certificate verify failed: unable to get local issuer certificate]
Here’s my bot code:
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix="!")
@bot.event
async def on_ready():
print("Bot has started successfully")
@bot.command()
async def greet(ctx):
await ctx.send("Hello there!")
bot.run("your-bot-token-here")
The bot won’t connect to Discord’s servers because of this SSL issue. Has anyone else encountered this problem? I’m not sure if it’s a network configuration issue or something with my Python environment. Any suggestions on how to fix this certificate verification error would be really helpful.
i had the same error a while back. turns out the firewall was causing issues with the ssl cert. maybe try using a different internet connection? like your phone’s hotspot. if it connects, then u know it’s a network issue, not ur bot code.
This SSL certificate error usually stems from outdated certificate authorities on your system. I encountered this exact issue when running Discord bots on older Python installations or corporate networks. The quickest fix is updating your certificate bundle by running pip install --upgrade certifi in your terminal. If that doesn’t work, you might need to update Python itself since older versions sometimes have outdated SSL libraries. Another possibility is your antivirus software interfering with SSL connections - temporarily disabling it can help identify if that’s the culprit. Corporate networks often have SSL inspection that breaks certificate chains, so if you’re on a work network, that could be the root cause.