element-hq / element-hq/synapse
Calling /createRoom with state events missing `content` should probably be a 400 rather than 500
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
This issue has been migrated from [#3420](https://github.com/matrix-org/synapse/issues/3420).
---
No `content` feels to me as a bad request rather than a stack trace:
```
=== RUN TestAccMatrixRoom_ExistingRoom
2018-06-21 16:33:50,520 - synapse.http.server - 102 - ERROR - POST-32- Failed handle request via : : Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 653, in _runCallbacks
current.result = callback(current.result, *args, **kw)
File "/usr/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1442, in gotResult
_inlineCallbacks(r, g, deferred)
File "/usr/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks
result = result.throwExceptionIntoGenerator(g)
File "/usr/local/lib/python2.7/site-packages/twisted/python/failure.py", line 422, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
--- ---
File "/usr/local/lib/python2.7/site-packages/synapse/http/server.py", line 79, in wrapped_request_handler
yield h(self, request)
File "/usr/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks
result = result.throwExceptionIntoGenerator(g)
File "/usr/local/lib/python2.7/site-packages/twisted/python/failure.py", line 422, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
File "/usr/local/lib/python2.7/site-packages/synapse/http/server.py", line 305, in _async_render
callback_return = yield callback(request, **kwargs)
File "/usr/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks
result = result.throwExceptionIntoGenerator(g)
File "/usr/local/lib/python2.7/site-packages/twisted/python/failure.py", line 422, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
File "/usr/local/lib/python2.7/site-packages/synapse/rest/client/v1/room.py", line 68, in on_POST
requester, self.get_room_config(request)
File "/usr/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1386, in _inlineCallbacks
result = g.send(result)
File "/usr/local/lib/python2.7/site-packages/synapse/handlers/room.py", line 181, in create_room
initial_state[(val["type"], val.get("state_key", ""))] = val["content"]
exceptions.KeyError: 'content'
--- FAIL: TestAccMatrixRoom_ExistingRoom (0.02s)
panic: code=M_UNKNOWN message=Internal server error raw={"errcode":"M_UNKNOWN","error":"Internal server error"} status_code=500 [recovered]
panic: code=M_UNKNOWN message=Internal server error raw={"errcode":"M_UNKNOWN","error":"Internal server error"} status_code=500
```
Contributor guide
Assessment
This issue has not been assessed yet.