What is the reason of this error. happening randomly
2025-04-29 12:35:13,776 [ERROR] Historical fetch failed for BANDHANBNK on 2025-04-28: Cannot connect to host api.upstox.com:443 ssl:default [[SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1028)]
2025-04-29 12:57:49,405 [ERROR] Historical fetch failed for BANDHANBNK on 2025-04-28: Cannot connect to host api.upstox.com:443 ssl:default [[SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1028)]
2025-04-29 13:30:28,730 [ERROR] Historical fetch failed for IEX on 2025-04-28: Cannot connect to host api.upstox.com:443 ssl:default [[SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1028)]
2025-04-29 13:55:35,330 [ERROR] Historical fetch failed for CDSL on 2025-04-28: Cannot connect to host api.upstox.com:443 ssl:default [[SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1028)]
Sorry @Anand_Sajankar I think I gave you wrong instrument key url. I confirm that I am already using url as suggested by you. I am fetching historical for around 215 stocks and problem occurs only in some stocks just randomly as u can see in today’s log
2025-05-05 09:21:49,778 [ERROR] Historical fetch failed for ABCAPITAL: Cannot connect to host api.upstox.com:443 ssl:default [[SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1028)]
2025-05-05 09:21:49,778 [ERROR] Historical fetch failed for ABCAPITAL: Cannot connect to host api.upstox.com:443 ssl:default [[SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1028)]
2025-05-05 09:41:55,553 [ERROR] Historical fetch failed for BAJAJ-AUTO: Cannot connect to host api.upstox.com:443 ssl:default [[SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1028)]
2025-05-05 09:41:55,553 [ERROR] Historical fetch failed for BAJAJ-AUTO: Cannot connect to host api.upstox.com:443 ssl:default [[SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1028)]
2025-05-05 09:49:09,147 [ERROR] Historical fetch failed for DABUR: Response payload is not completed: <TransferEncodingError: 400, message=‘Not enough data for satisfy transfer length header.’>. SSLError(1, ‘[SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:2648)’)
2025-05-05 09:49:09,147 [ERROR] Historical fetch failed for DABUR: Response payload is not completed: <TransferEncodingError: 400, message=‘Not enough data for satisfy transfer length header.’>. SSLError(1, ‘[SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:2648)’)
2025-05-05 10:11:55,154 [ERROR] Historical fetch failed for GMRAIRPORT: Cannot connect to host api.upstox.com:443 ssl:default [[SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1028)]
2025-05-05 10:11:55,154 [ERROR] Historical fetch failed for GMRAIRPORT: Cannot connect to host api.upstox.com:443 ssl:default [[SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1028)]
2025-05-05 10:22:09,433 [ERROR] Error fetching data (attempt 1): Response payload is not completed: <TransferEncodingError: 400, message=‘Not enough data for satisfy transfer length header.’>. SSLError(1, ‘[SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:2648)’)
2025-05-05 10:22:09,433 [ERROR] Error fetching data (attempt 1): Response payload is not completed: <TransferEncodingError: 400, message=‘Not enough data for satisfy transfer length header.’>. SSLError(1, ‘[SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:2648)’)
@gaurav This is not a server-side issue; it appears to be related to the client environment. The error is likely caused by network instability leading to corrupted SSL packets. Please check your internet connection, try switching to a different or wired network, and temporarily disable any VPN or proxy if you’re using one.
If you are still getting the same issue, please do share your code for further investigation.