Discord.py: 'Overwrites' got an unexpected keyword argument 'deny_new'/'allow_new'

Created on 9 Jul 2020  路  12Comments  路  Source: Rapptz/discord.py

Summary

Discord pushed a new change that changes the overwrites object.

However, after testing a bit, it seems to be completely random when it happens. This seems to no longer hold true.

Reproduction Steps

while True:
  await bot.fetch_channel(any_text_channel.id)

The while True is just to make sure the error appears, as it is random when it appears.

Expected Results

For an error to not occur while I'm executing this function.

Actual Results

Traceback (most recent call last):
  File "/home/xua/abyss/venv/lib/python3.7/site-packages/discord/client.py", line 1376, in fetch_channel
    channel = factory(guild=guild, state=self._connection, data=data)
  File "/home/xua/abyss/venv/lib/python3.7/site-packages/discord/channel.py", line 107, in __init__
    self._update(guild, data)
  File "/home/xua/abyss/venv/lib/python3.7/site-packages/discord/channel.py", line 131, in _update
    self._fill_overwrites(data)
  File "/home/xua/abyss/venv/lib/python3.7/site-packages/discord/abc.py", line 304, in _fill_overwrites
    self._overwrites.append(_Overwrites(id=overridden_id, **overridden))
TypeError: __new__() got an unexpected keyword argument 'allow_new'

Checklist

  • [x] I have searched the open issues for duplicates.
  • [x] I have shown the entire traceback, if possible.
  • [x] I have removed my token from display, if visible.

System Information

  • Python v3.7.8-final
  • discord.py v1.4.0-alpha

    • discord.py pkg_resources: v1.4.0a2373+gc995a5e

  • aiohttp v3.6.2
  • system info: Linux 4.19.0-9-amd64 #1 SMP Debian 4.19.118-2 (2020-04-29)

This has also been reproduced on 1.3.3, and a new payload example can be found:

        {
            "allow": 0,
            "allow_new": "0",
            "deny": 3072,
            "deny_new": "3072",
            "id": "448666839778590730",
            "type": "role"
        }
bug

Most helpful comment

Update to the most recent version of discord.py

All 12 comments

I have same issue with await channel.clone().
This issue is very critical. Can you fix it as soon as possible?

So, how do I fix this ?

Update to the most recent version of discord.py

My friend and I just got identical errors on our bots, is there a fix? I already tried updating discord.py.

Edit: The update did not work, did it again and fixed it. 馃憤

I just got this error, and updating to discord 1.3.4 fixed it.

I ran into this issue. The only difference is that the keyword argument at my side is deny_new. Updated to 1.3.4 by checking it via pip show discord.py and re-install the package. The issue still exists.

See https://github.com/Rapptz/discord.py/issues/5109#issuecomment-662267876

Please add the following line to your bot's code and show the results: print(discord.__version__). Chances are high that you've updated/installed 1.3.4 in some other python environment, but not the one you're running your bot from.

This is the full stacktrace of the error logged (I am running it on IIS, so the only way I know to get the error is log it)

Exception in thread Thread-55:
Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "C:\Program Files\Python38\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Program Files\Python38\lib\asyncio\base_events.py", line 612, in run_until_complete
    return future.result()
  File ".\extdiscord\core.py", line 159, in start
    await self._core.start(token)
  File "C:\Users\Administrator\Documents\Applications\Jelly-Bot\venv\lib\site-packages\discord\client.py", line 543, in start
    await self.connect(reconnect=reconnect)
  File "C:\Users\Administrator\Documents\Applications\Jelly-Bot\venv\lib\site-packages\discord\client.py", line 457, in connect
    await self._connect()
  File "C:\Users\Administrator\Documents\Applications\Jelly-Bot\venv\lib\site-packages\discord\client.py", line 421, in _connect
    await self.ws.poll_event()
  File "C:\Users\Administrator\Documents\Applications\Jelly-Bot\venv\lib\site-packages\discord\gateway.py", line 469, in poll_event
    await self.received_message(msg)
  File "C:\Users\Administrator\Documents\Applications\Jelly-Bot\venv\lib\site-packages\discord\gateway.py", line 423, in received_message
    func(data)
  File "C:\Users\Administrator\Documents\Applications\Jelly-Bot\venv\lib\site-packages\discord\state.py", line 663, in parse_guild_create
    guild = self._get_create_guild(data)
  File "C:\Users\Administrator\Documents\Applications\Jelly-Bot\venv\lib\site-packages\discord\state.py", line 638, in _get_create_guild
    guild._from_data(data)
  File "C:\Users\Administrator\Documents\Applications\Jelly-Bot\venv\lib\site-packages\discord\guild.py", line 391, in _from_data
    self._sync(guild)
  File "C:\Users\Administrator\Documents\Applications\Jelly-Bot\venv\lib\site-packages\discord\guild.py", line 420, in _sync
    self._add_channel(VoiceChannel(guild=self, data=c, state=self._state))
  File "C:\Users\Administrator\Documents\Applications\Jelly-Bot\venv\lib\site-packages\discord\channel.py", line 504, in __init__
    self._update(guild, data)
  File "C:\Users\Administrator\Documents\Applications\Jelly-Bot\venv\lib\site-packages\discord\channel.py", line 535, in _update
    self._fill_overwrites(data)
  File "C:\Users\Administrator\Documents\Applications\Jelly-Bot\venv\lib\site-packages\discord\abc.py", line 271, in _fill_overwrites
    self._overwrites.append(_Overwrites(id=overridden_id, **overridden))
TypeError: __new__() got an unexpected keyword argument 'deny_new'

self._core is an initialized discord.Client.


Here is the result of print(discord.__version__)

C:\Users\Administrator>py
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import discord
>>> discord.__version__
'1.3.4'

I am NOT using any virtual environments and this is the only python interpreter on my server.
I found that despite it should not run under the virtual environment, my setting contains error so that it is actually running using my old testing venv.

@RaenonX It's easy to verify that you're running a different version by actually checking the line numbers on the traceback and matching them with the code that is currently pushed to PyPI as 1.3.4. Your traceback says line 271 points to the overwrite object creation but in reality line 271 points to something else entirely:

https://github.com/Rapptz/discord.py/blob/3cdfeb6b4b03ad81185e78740d1a9a00ea7f2b62/discord/abc.py#L271

That's because _fill_overwrite Overwrite creation got moved to line 308 since the fix expanded the line count by a few lines as seen here

https://github.com/Rapptz/discord.py/blob/3cdfeb6b4b03ad81185e78740d1a9a00ea7f2b62/discord/abc.py#L308

So whatever is happening is due to an out of date library version. Best to check out why it's happening but this issue tracker is not the place for that.

@Rapptz Thanks for pointing out that. Gonna see why is this happening.

Please keep us updated. My servers depend on red v2

This has been fixed in 1.3.4, please update your discord.py version.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Mercurial picture Mercurial  路  22Comments

ThePiGuy24 picture ThePiGuy24  路  17Comments

wolfclaws picture wolfclaws  路  17Comments

ams2990 picture ams2990  路  14Comments

marcoshuck picture marcoshuck  路  16Comments