doc/user/project/repository/code_suggestions/troubleshooting.md
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.
For more information on troubleshooting GitLab Duo, see:
If suggestions are not displayed, ensure that you:
If suggestions are still not displayed, try the following troubleshooting steps for the different IDEs:
Code Suggestions depends on a license token that synchronizes your subscription with GitLab.
When the token expires, Code Suggestions returns the following error with status 401:
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.
The problem might be driven to the recent changes in authentication, specifically the token system. To resolve the issue:
The following documentation is for Code Suggestions-specific troubleshooting for VS Code.
For all other GitLab for VS Code troubleshooting, see troubleshooting the GitLab for VS Code extension.
If you are on GitLab Self-Managed, ensure that Code Suggestions for the GitLab Web IDE is enabled. The same settings apply to VS Code as local IDE.
If Code Suggestions is enabled for the IDE, but suggestions are still not displayed:
GitLab: Show Extension Logs.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, open the Settings editor:
In the upper-right corner, select Open Settings (JSON) to edit your settings.json file:
In your settings.json file, add this line, or set it to false it already exists:
"gitlab.featureFlags.streamCodeGenerations": false,
Save your changes.
{{< history >}}
{{< /history >}}
To reduce latency, the GitLab for VS Code 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.
The following documentation is for Code Suggestions-specific troubleshooting for JetBrains IDEs.
For non-Code Suggestions troubleshooting for JetBrains IDEs, see JetBrains troubleshooting.
unable to find valid certification path to requested targetThe GitLab Duo plugin verifies TLS certificate information before connecting to your GitLab instance. You can add a custom SSL certificate.
Failed to check tokenThis 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:
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.
Code Suggestions requires the IntelliCode component of Visual Studio. If the component is missing, you might see an error like this when you start Visual Studio:
SetSite failed for package [VisualStudioPackage]Source: 'Microsoft.VisualStudio.Composition'
Description: Expected 1 export(s) with contract name "Microsoft.VisualStudio.Language.Suggestions.SuggestionServiceBase"
but found 0 after applying applicable constraints.
Microsoft.VisualStudio.Composition.CompositionFailedException:
Expected 1 export(s) with contract name "Microsoft.VisualStudio.Language.Suggestions.SuggestionServiceBase"
but found 0 after applying applicable constraints.
at Microsoft.VisualStudio.Composition.ExportProvider.GetExports(ImportDefinition importDefinition)
at Microsoft.VisualStudio.Composition.ExportProvider.GetExports[T,TMetadataView](String contractName, ImportCardinality cardinality)
at Microsoft.VisualStudio.Composition.ExportProvider.GetExport[T,TMetadataView](String contractName)
at Microsoft.VisualStudio.Composition.ExportProvider.GetExportedValue[T]()
at Microsoft.VisualStudio.ComponentModelHost.ComponentModel.GetService[T]()
[...]
To fix this problem, install the IntelliCode component:
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:
The following documentation is for Code Suggestions-specific troubleshooting for Neovim.
For non-Code Suggestions troubleshooting for Neovim, see Neovim troubleshooting.
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())
If you are assigned a seat in a project that has a specific model selected for code completion:
This might cause increased latency with code completion requests.