I am using the following lines in my preamble to force long URLs in the bibliography to be broken, this is working mostly successfully however it doesn't seem to be working on an entry where I have had to escape percent signs.

\usepackage{url}
\def\UrlBreaks{\do\/\do-}
\usepackage{breakurl}
\usepackage{hyperref}


Bibliography entry

@online{talex,
title = {{Comprehensive Talos examples}},
year = {2019},
url = {https://nbviewer.jupyter.org/github/autonomio/talos/blob/master/examples/Hyperparameter\%20Optimization\%20with\%20Keras\%20for\%20the\%20Iris\%20Prediction.ipynb}
}

• Welcome to TeX.SE. Is the xurl package on your system. If so, load it instead of url, don't load the breakurl package, and get rid of the def\UrlBreaks{\do\/\do-} package. – Mico May 22 at 21:09
• I have installed the xurl package and removed the other lines but the error still seems to be persisting. – User May 22 at 22:00
• I should also mention I am using natbib – User May 22 at 22:18
• Most bibliography styles that support a url field support it in a way that does not require you to escape % with a backslash if the url and/or hyperref package is loaded. I wouldn't load breakurl and would instead try xurl if the normal url doesn't break properly. But we can only give more specific advice if you can turn the two code snippets into a fully working example document (tex.meta.stackexchange.com/q/228/35864, tex.meta.stackexchange.com/q/4407/35864). – moewe May 23 at 5:21