Troubleshooting Cody
Learn about common reasons for errors that you might run into when using Cody and how to troubleshoot them.
If you encounter errors or bugs while using Cody, try applying these troubleshooting methods to understand and configure the issue better. If the problem persists, you can report Cody bugs using the issue tracker, by using the Support Forum, or by asking in the Discord server.
VS Code extension
Cody is not responding in chat
If you're experiencing issues with Cody not responding in chat, follow these steps:
- Ensure you have the latest version of the Cody VS Code extension. Use the VS Code command
Extensions: Check for Extension Updates
to verify - Check the VS Code error console for relevant error messages. To open it, run the VS Code command
Developer: Toggle Developer Tools
and then look in theConsole
for relevant messages
Access Cody logs
VS Code logs can be accessed via the Outputs view. You will need to set Cody to verbose mode to ensure important information to debug is on the logs. To do so:
- Go to the Cody Extension Settings and enable:
Cody › Debug: Verbose
- Restart or reload your VS Code editor
- You can now see the logs in the Outputs view
- Open the view via the menu bar:
View > Output
- Select Cody by Sourcegraph from the dropdown list
- You can export the logs by using the command palette (Cmd+Shift+P on Mac, Ctrl+Shift+P on Windows/Linux) and searching for the "Cody Debug: Export Logs" command
Errors trying to install Cody on macOS
If you encounter the following errors:
BASHCommand 'Cody: Set Access Token' resulted in an error Command 'cody.set-access-token' not found
Follow these steps to resolve the issue:
- Close your VS Code editor
- Open your Keychain Access app
- Search for
cody
- Delete the
vscodesourcegraph.cody-ai
entry in the system keychain on the left - Reopen the VS Code editor. This should resolve the error
Signin fails on each VS Code restart
If you find yourself being automatically signed out of Cody every time you restart VS Code, and suspect it's due to keychain authentication issues, you can address this by following the steps provided in the official VS Code documentation on troubleshooting keychain issues. These guidelines should help you troubleshoot and resolve any keychain-related authentication issues, ensuring a seamless experience with Cody on VS Code.
No context files were included by Cody
If Cody's answers don't seem accurate, it may be because Cody is unable to find the right relevant files to use as context. You can see which files Cody used in the Context row right below your message.
To troubleshoot further:
- Enable the
cody.debug.verbose
setting in your VS Code user settings. - Open the Cody by Sourcegraph output channel in VS Code.
- Look for log messages such as the following:
BASH█ SimpleChatPanelProvider: getEnhancedContext > search █ symf: using downloaded symf "/Users/beyang/Library/Application Support/Code/User/globalStorage/sourcegraph.cody-ai/symf/symf-v0.0.6-aarch64-macos" █ SimpleChatPanelProvider: getEnhancedContext > search (end) █ DefaultPrompter.makePrompt: Ignored 8 additional context items due to limit reached
Rate limits
Cody Free provides unlimited autocomplete suggestions and 200 chat invocations per user per month.
On Cody Pro and Enterprise plans, usage is unlimited but controlled by Fair Usage. This means that some users occasionally experience a limitation placed on their account. This limitation resets within 24 hours. If this issue persists, contact us through our community forum, Discord, or email [email protected].
429 errors
A 429 status code means you are on a free account and hit your usage limit/quota for the day. It can also mean you were sending too many requests in a short period of time. If you have Cody Pro and you are seeing 429 errors, you can contact us at [email protected] to resolve this.
Error logging in VS Code on Linux and Windows
If you encounter difficulties logging in to Cody on Linux using your Sourcegraph instance URL, along with a valid access token, and notice that the sign-in process in VS Code hangs, it might be related to underlying networking rules concerning SSL certificates.
To address this, follow these steps:
- Close your VS Code editor
- In your terminal, type and run the following command:
echo "export NODE_TLS_REJECT_UNAUTHORIZED=0">> ~/.bashrc
- Restart VS Code and try the sign in process again
On Windows,
- Close Visual Studio Code
- In your Command Prompt or PowerShell window, run the following command:
setx NODE_TLS_REJECT_UNAUTHORIZED 0
- Restart Visual Studio Code and try the sign in process again
Cloudflare Request Failed
If you encounter this error:
SHELLRequest Failed: Request to https://sourcegraph.com/.api/completions/stream?api-version=1&client-name=vscode&client-version=1.34.3 failed with 403 Forbidden
It indicates that our web application firewall provider, Cloudflare, has flagged the source IP as suspicious.
Consider disabling anonymizers, VPNs, or open proxies. If using a VPN is essential, you can try 1.1.1.1, which is recognized to be compatible with our services.
VS Code Pro License Issues
If VS Code prompts you to upgrade to Pro despite already having a Pro license, this usually happens because you're logged into a free Cody/Sourcegraph account rather than your Pro account. To fix this:
- Check which account you're currently logged into
- If needed, log out and sign in with your PRO account credentials
Error exceeding localStorage
quota
When using Cody chat, you may come across this error:
BASHFailed to execute 'setItem' on 'Storage': Setting the value of 'user-history:$user_id' exceeded the quota.
This error indicates that the chat history size surpasses the capacity of your browser's local storage. Cody stores comprehensive context data with each chat message, contributing to this limitation.
To fix this, navigate to https://sourcegraph.your-domain.com/cody/chat and click Clear Chat History
if your instance is on v5.2.3+. For older versions, clear your browsing data or browser history.
Record performance traces for Cody
You can get performance traces from the Cody VS Code extension in production with full support for source maps. To do so:
- Start VS Code with a special runtime flag. In macOS, you can do so via the terminal like this:
BASH/Applications/Visual\ Studio\ Code.app/Contents/MacOS/Electron --inspect-extensions=9333
Note that you may need to quit VSCode first, then run that command to re-launch it. It will open all of your windows and tabs again.
- After VS Code is started, head over to Chrome and go to
chrome://inspect
, which takes you to the following:
- Configure the inspect server you started on port
9333
from here. To do so, click on Open dedicated DevTools for Node, then go to the Connection tab, and make sure to addlocalhost:9333
to the list
- Now head back to the
chrome://inspect
tab, and you should see a new remote target that you can inspect
- Clicking this will open a (somewhat reduced) DevTools view. Great! We've almost got it. From here you can go to the Performance tab to record a trace. And finally, swap tabs to the VS Code window and interact with the extension. Come back later to stop the recording and export it.
Record a CPU profile for Cody in VSCode
If you are experiencing performance issues with Cody in VSCode, recording a CPU profile can help diagnose the problem. Here’s how you can capture a CPU profile:
-
Open Developer Tools:
- In VSCode, go to the Command Palette (
Ctrl+Shift+P
on Windows/Linux,Cmd+Shift+P
on macOS). - Type
Developer: show running extensions
and select it to open running extensions.
- In VSCode, go to the Command Palette (
-
Record the CPU Profile:
- There you should see Cody in the list. Right click on it and start a host profile.
- This will show you the running profile in the bottom right of the window.
- Reproduce the issue you are experiencing with Cody.
- Once you have reproduced the issue, click the message in the bottom right you stop the trace.
-
Save the CPU Profile:
- After stopping the trace, you need to go back to the Developer: show running extensions view.
- Right click Cody and click
Save extension profile
.
-
Share the CPU Profile:
- Attach the
.cpuprofile
file to your issue report on GitHub or share it with the support team for further analysis.
- Attach the
Following these steps will help the team understand and resolve the performance issues more effectively.
JetBrains IntelliJ extension
Access Cody logs
JetBrains logs can be accessed via the Output panel. To access logs, you must first enable Cody logs from the Settings menu. To do so:
- Open the Settings panel (
⌘,
for macOS) (Ctrl+Alt+S
for Windows) - Go to
Sourcegraph & Cody
- Click on
Cody
- Check the box to Enable debug
- Optionally, select the box to enable Verbose debug
- Click Apply
- To access the logs, go to Help - Show Log in Finder
- Open the
idea.log
file
High CPU Usage with Cody Agent
If you notice the Cody agent reaching 100% CPU utilization, try the following:
- Disable the Cody plugin.
- Re-enable the plugin. This simple action of turning the plugin off and on again can often resolve the high CPU usage issue.
Android Studio extension
Cody cannot start. Stuck on spinning icon.
This issue occurs because JCEF isn't supported in Android Studio and causes Cody to not start. The suggested workaround is to:
- Go to
Help
>Find Action: Registry
. - Scroll to
ide.browser.jcef.sandbox.enable
. - Disable that key and close.
- Then go to
Help
>Find Action: Choose Boot runtime for the IDE
. - Select the last option.
- Restart Android Studio.
Regular Expressions
Asterisks being removed
If you send Cody a prompt with a query string like $filteredResults = preg_grep('*\.' . basename($inputPath) . '\.*', $fileList);
, the asterisks may be removed because Cody interprets the content as a literal string rather than code.
When sharing code with Cody, wrap your code in triple backticks (```) to ensure it's recognized as a code block rather than plain text. For example:
REGEX``` $filteredResults = preg_grep('*\.' . basename($inputPath) . '\.*', $fileList); ```
Eclipse extension
See a white screen the first time you open Cody chat
This can happen if Eclipse prompts you to set up a password for secure storage and Cody timeouts while waiting. Simply close and re-open the Cody chat.
"No password provided" in the error log
If you see this error in the error log, it happens because the default OS password integration has been corrupted. Go to Preferences > General > Security > Secure Storage and ensure your OS integration is checked.
Then click Clear Passwords at the top, and then click Change Password. If you see a dialog saying An error occurred while decrypting stored values... Do you want to cancel password change? Click No.
This will reset the secure storage master password for OS integration. You will be asked if you want to provide additional information for password recovery, which is optional. Click Apply and Close and then restart Eclipse.
General Tips
You can open the Cody Log view using the same steps as above, but instead, select Cody Log.
This will include more information about what Cody is doing, including any errors. There is a copy button at the top right of the log view that you can use to copy the log to your clipboard and send it to us. Be careful not to include any sensitive information, as the log communication is verbose and may contain tokens.
Additionally, Eclipse's built-in Error Log can be used to view any uncaught exceptions and their stack traces. You can open the Error Log using the Window > Show View > Error Log menu.