No syntax highlighting and inability to copy individual lines of code from generated Jupyter cells

As per title. Sometimes it works normally and the code is highlighted and I can copy paste whatever I please like a regular generated block of code but a lot of the time it’s like this, where if i try to click anywhere in the code block to select text it tries to open the file which results in this error: