'shell-init error in VSCode when "code ." command is issued in terminal

I have been encountering this issue for a while an haven't been able to find a specific solution to my unique problem. Some context for my issue is that I have been using cd to get into the directory that I want to open up in vscode and once I am inside the directory I used the command line to open VSCode using code . However, whenever I use this command, VSCode opens up with the folder name view on the left side however none of the files are retrieved. Additionally, an error message is being outputted in my CLI saying the following:

shell-init: error retrieving current directory: getcwd: cannot access parent directories: Operation not permitted
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Operation not permitted

Some solutions that I have seen to this error are that I am changing directories into a directory that no longer exists; However, this is not the case with the directory I am in because I can still see it in my finder (I am using the documents path). Some other solutions that I saw were to kill my terminal and try again but that also didn't work. Some background is that I am on Mac OS Monterey M1 Chip and on VSCode version 1.67.2. Here are some pictures that might aid in helping me solve this problem

This is my terminal with the commands I am using

My VSCode window and terminal with error output

If anyone has any insight that may be of use I would greatly appreciate it!



Sources

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

Source: Stack Overflow

Solution Source