# Error in mismatched columns: consuming ws messages

**URL:** https://forum.alpaca.markets/t/error-in-mismatched-columns-consuming-ws-messages/4310
**Category:** App-Integration
**Created:** [February 5, 2021, 10:35pm UTC](https://forum.alpaca.markets/t/error-in-mismatched-columns-consuming-ws-messages/4310 "2021-02-05T22:35:19Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Greengage](https://avatars.discourse-cdn.com/v4/letter/g/7bcc69/32.png) [@Greengage](https://forum.alpaca.markets/u/Greengage)
#### Post date: [February 5, 2021, 10:35pm UTC](https://forum.alpaca.markets/t/error-in-mismatched-columns-consuming-ws-messages/4310/1 "2021-02-05T22:35:19Z")

</div>

I am stuck on this issue. This is the code that was written in the Medium post. I have been trying to debug it. I have it to this point where it appears to get the ticker data and historical data but then hits a wall and cites mismatch columns. I’m not sure what I need to align. Any help would be appreciated.

primary@wm1:~$ python3.6 wm4\_v3.txt  
Getting current ticker data…  
Success.  
Tracking 309 symbols.  
Getting historical data…  
1/309  
Success.  
Watching 309 symbols.  
ERROR:root:error while consuming ws messages: cannot set a row with mismatched columns  
^CTraceback (most recent call last):  
File “/home/primary/.local/lib/python3.6/site-packages/alpaca\_trade\_api/stream2.py”, line 331, in run  
loop.run\_until\_complete(self.consume())  
File “/usr/lib/python3.6/asyncio/base\_events.py”, line 484, in run\_until\_complete  
return future.result()  
File “/home/primary/.local/lib/python3.6/site-packages/alpaca\_trade\_api/stream2.py”, line 316, in consume  
self.data\_ws.consume(),  
File “/home/primary/.local/lib/python3.6/site-packages/alpaca\_trade\_api/polygon/streamconn.py”, line 108, in cons  
ume  
await self.\_consume\_task  
File “/home/primary/.local/lib/python3.6/site-packages/alpaca\_trade\_api/polygon/streamconn.py”, line 114, in \_con  
sume\_msg  
await self.\_dispatch(data)  
File “/home/primary/.local/lib/python3.6/site-packages/alpaca\_trade\_api/polygon/streamconn.py”, line 221, in \_dis  
patch  
await handler(self, channel, ent)  
File “wm4\_v3.txt”, line 192, in handle\_second\_bar  
minute\_history[symbol].loc[ts] = new\_data  
File “/home/primary/.local/lib/python3.6/site-packages/pandas/core/indexing.py”, line 670, in **setitem**  
iloc.\_setitem\_with\_indexer(indexer, value)  
File “/home/primary/.local/lib/python3.6/site-packages/pandas/core/indexing.py”, line 1626, in \_setitem\_with\_inde  
xer  
self.\_setitem\_with\_indexer\_missing(indexer, value)  
File “/home/primary/.local/lib/python3.6/site-packages/pandas/core/indexing.py”, line 1856, in \_setitem\_with\_inde  
xer\_missing  
raise ValueError(“cannot set a row with mismatched columns”)  
ValueError: cannot set a row with mismatched columns  
During handling of the above exception, another exception occurred:  
Traceback (most recent call last):

---

<div class="post-metadata">

### Author: ![Greengage](https://avatars.discourse-cdn.com/v4/letter/g/7bcc69/32.png) [@Greengage](https://forum.alpaca.markets/u/Greengage)
#### Post date: [February 8, 2021, 3:28pm UTC](https://forum.alpaca.markets/t/error-in-mismatched-columns-consuming-ws-messages/4310/2 "2021-02-08T15:28:38Z")

</div>

Resolved this issue. Followed direction from the Github post.
