question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

KeyError from create_application

See original GitHub issue

Since upgrading to Channels 2, I get a number of these errors. I suspect this happens when restarting the deployed instance:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/daphne/http_protocol.py", line 160, in process
    "server": self.server_addr,
  File "/usr/local/lib/python3.6/site-packages/twisted/internet/defer.py", line 1386, in _inlineCallbacks
    result = g.send(result)
  File "/usr/local/lib/python3.6/site-packages/daphne/server.py", line 191, in create_application
    ), loop=asyncio.get_event_loop())
KeyError: <WebRequest at 0x7ff738677710 method=GET uri=/api/internal/projects/21/managed_objects/ clientproto=HTTP/1.1>

Unfortunately, it doesn’t help that there is a lot happening on this line, and I am not sure what part causes this error.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:26 (21 by maintainers)

github_iconTop GitHub Comments

1reaction
brianmaycommented, Jun 12, 2018

Reference to commit that (hopefully) fixed this: ece52b8e7958b41c86fd89830bc7814368e42bde

1reaction
JohnDoeecommented, May 31, 2018
Traceback (most recent call last):
  File "/home/tarek/Documents/python/lms-mt/env/lib/python3.5/site-packages/daphne/http_protocol.py", line 166, in process
    "body": self.content.read(),
ValueError: I/O operation on closed file.

Twisted closes “content” when the connection is lost, i.e. request is “finished” internally in Twisted. I fixed it by checking if self.content.closed: before initiating the request handling where content is read.

Similar error only happened for me when using nginx as reverse proxy and I was able to reproduce it consistently when I found a working way to trigger it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

I am getting a `KeyError` when I receive a request to my API
1 Answer 1 · return json. · The client ignores the JSON response and calls location. · Links with href="#" are poor practice....
Read more >
Common Errors - Amazon SageMaker - AWS Documentation
This section lists the errors common to the API actions of all AWS services. For errors specific to an API action for this...
Read more >
AWS Lambda with API Gateway throwing response error #219
I'd like to be able to say exports.handler = app and for it to magically work whether the object passed in is a...
Read more >
Error and Warning Dictionary | Twilio
ERROR Programmable Voice. Invalid BYOC trunk SID. 21301. Learn more. ERROR Programmable Voice. Cannot create application: application limit exceeded.
Read more >
Openshift Flask: KeyError: 'socketio' : r/learnpython - Reddit
I am attempting to write a webchat to be run on Openshift, based on the code here . I invoke the program with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found