- Suggestions are not displayed
- Code Suggestions returns a 401 error
- Authentication troubleshooting
- VS Code troubleshooting
- JetBrains IDEs troubleshooting
- Microsoft Visual Studio troubleshooting
- Neovim troubleshooting
Troubleshooting Code Suggestions
- Changed to require GitLab Duo add-on in GitLab 17.6 and later.
When working with GitLab Duo Code Suggestions, you might encounter the following issues.
You can run a health check to test if your instance meets the requirements to run Code Suggestions.
Suggestions are not displayed
If suggestions are not displayed, ensure that you:
- Have configured GitLab Duo correctly.
- Are using a supported language and editor extension.
- Have configured your editor extension correctly.
If suggestions are still not displayed, try the following troubleshooting steps for the different IDEs:
Code Suggestions returns a 401 error
Code Suggestions depends on a license token that synchronizes your subscription with GitLab.
If the token expires, GitLab Duo Code Suggestions returns the following error
with status 401
when the token has expired:
Token validation failed in Language Server:
(Failed to check token: Error: Fetching Information about personal access token
If GitLab has access to the cloud server, try manually synchronizing your license.
Authentication troubleshooting
The problem might be driven to the recent changes in authentication, specifically the token system. To resolve the issue:
- Remove the existing personal access token from your GitLab account settings.
- Reauthorize your GitLab account using OAuth.
- Test the Code Suggestions feature with different file extensions to verify if the issue is resolved.
VS Code troubleshooting
The following documentation is for Code Suggestions-specific troubleshooting for VS Code.
For non-Code Suggestions troubleshooting for VS Code, see Troubleshooting the GitLab Workflow extension for VS Code.
Suggestions not displayed in VS Code or GitLab Web IDE
If you are a self-managed user, ensure that Code Suggestions for the GitLab Web IDE is enabled. The same settings apply to VS Code as local IDE.
- On the left sidebar, select Extensions > GitLab Workflow.
- Select Settings (), and then select Extension Settings.
- In GitLab > Duo Code Suggestions, select the GitLab Duo Code Suggestions checkbox.
View Code Suggestions logs
If Code Suggestions are enabled for the IDE, but suggestions are still not displayed:
- In your IDE, in the GitLab Workflow Extension Settings, enable GitLab: Debug.
- On the top menu, select View > Output to open the bottom panel, then either:
- In the command palette, select
GitLab: Show Extension Logs
. - In the bottom panel, on the right, select the dropdown list to filter the logs. Select GitLab Workflow.
- In the command palette, select
- In the GitLab Workflow Extension Settings, clear and re-select the GitLab Duo Code Suggestions checkbox.
Disable streaming of code generation results
By default, code generation streams AI-generated code. Streaming sends generated code to your editor incrementally, rather than waiting for the full code snippet to generate. This allows for a more interactive and responsive experience.
If you prefer to see code generation results only when they are complete, you can turn off streaming. Disabling streaming means that code generation requests might be perceived as taking longer to resolve. To disable streaming:
- In VS Code, on the top bar, go to Code > Settings > Settings.
-
On the top right corner, select Open Settings (JSON) to edit your
settings.json
file: -
In your
settings.json
file, add this line, or set it tofalse
it already exists:"gitlab.featureFlags.streamCodeGenerations": false,
- Save your changes.
Error: Direct connection fails
- Direct connection introduced in GitLab 17.2.
To reduce latency, the Workflow extension tries to send suggestion completion requests directly to GitLab Cloud Connector, bypassing the GitLab instance. This network connection does not use the proxy and certificate settings of the VS Code extension.
If your GitLab instance doesn’t support direct connections, or your network prevents the extension from connecting to GitLab Cloud Connector, you might see these warnings in your logs:
Failed to fetch direct connection details from GitLab instance.
Code suggestion requests will be sent to GitLab instance.
This error means your instance either doesn’t support direct connections, or is misconfigured.
If you see this error, the extension can’t connect to GitLab Cloud Connector, and is reverting to use your GitLab instance:
Direct connection for code suggestions failed.
Code suggestion requests will be sent to your GitLab instance.
The indirect connection through your GitLab instance is about 100 ms slower, but otherwise works the same. This issue is often caused by network connection problems, like with your LAN firewall or proxy settings.
JetBrains IDEs troubleshooting
The following documentation is for Code Suggestions-specific troubleshooting for JetBrains IDEs.
For non-Code Suggestions troubleshooting for JetBrains IDEs, see JetBrains troubleshooting.
Suggestions not displayed in JetBrains IDEs
- From the Tools > GitLab Duo menu, select Verify setup. Make sure the health check passes.
- Verify that your JetBrains IDE natively supports the language of the file you are working on. Go to Settings > Languages & Frameworks to see the full list of languages and frameworks supported by your JetBrains IDE.
Error: unable to find valid certification path to requested target
The GitLab Duo plugin verifies TLS certificate information before connecting to your GitLab instance. You can add a custom SSL certificate.
Error: Failed to check token
This error occurs when the provided connection instance URL and authentication token passed through to the GitLab Language Server process are invalid. To re-enable Code Suggestions:
- In your IDE, on the top bar, select your IDE name, then select Settings.
- On the left sidebar, select Tools > GitLab Duo.
- Under Connection, select Verify setup.
- Update your Connection details as needed.
- Select Verify setup, and confirm that authentication succeeds.
- Select OK or Save.
Microsoft Visual Studio troubleshooting
The following documentation is for Code Suggestions-specific troubleshooting for Microsoft Visual Studio.
For non-Code Suggestions troubleshooting for Microsoft Visual Studio, see Visual Studio troubleshooting.
Suggestions not displayed in Microsoft Visual Studio
- Ensure you have properly set up the extension.
- From the Tools > Options menu, find the GitLab option. Ensure Log Level is set to Debug.
- Open the extension log in View > Output and change the dropdown list to GitLab Extension as the log filter.
- Verify that the debug log contains similar output:
14:48:21:344 GitlabProposalSource.GetCodeSuggestionAsync
14:48:21:344 LsClient.SendTextDocumentCompletionAsync("GitLab.Extension.Test\TestData.cs", 34, 0)
14:48:21:346 LS(55096): time="2023-07-17T14:48:21-05:00" level=info msg="update context"
If another extension provides similar suggestion or completion features, the extension might not return suggestions. To resolve this:
- Disable all other Visual Studio extensions.
- Confirm that you now receive Code Suggestions.
- Re-enable extensions one at a time, testing for Code Suggestions each time, to find the extension that conflicts.
Neovim troubleshooting
The following documentation is for Code Suggestions-specific troubleshooting for Neovim.
For non-Code Suggestions troubleshooting for Neovim, see Neovim troubleshooting.
Code completions fails
-
Confirm
omnifunc
is set in Neovim::verbose set omnifunc?
-
Confirm the Language Server is active by running this command in Neovim:
:lua =vim.lsp.get_active_clients()
- Check the logs for the Language Server in
~/.local/state/nvim/lsp.log
. -
Inspect the
vim.lsp
log path for errors by running this command in Neovim::lua =vim.cmd('view ' .. vim.lsp.get_log_path())