'Error in new.session() : Could not establish session after 5 attempts

I've been facing in R the error message for days using getSymbols of the quantmod package:

Error in new.session() : Could not establish session after 5 attempts.
getSymbols(tick, from = date_from,  to = date_to, warnings = FALSE, auto.assign = TRUE)

The same issue applies to:

getSymbols(tick, from = date_from,  to = date_to, warnings = FALSE, auto.assign = TRUE, src="yahoo")


Solution 1:[1]

Update QuantMod and try again:

install.packages('quantmod')

This was a bug that was fixed very swiftly. Thank you Joshua Ulrich!


History (2022-04-29):

This was an issue on 2022-04-29 that Joshua Ulrich promptly published a fix for. You could install the patched version with:

remotes::install_github("joshuaulrich/[email protected]")

But the changes are now into CRAN, so you should just be able to update QuantMod and continue with your day.

Link to fix: GitHub: joshuaulrich/[email protected]

GitHub issue here.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1