Troubleshooting the GitLab Workflow extension for VS Code

If you encounter any issues with the GitLab Workflow extension for VS Code, or have feature requests for it:

  1. Check the extension documentation for known issues and solutions.
  2. Report bugs or request features in the gitlab-vscode-extension issue queue.

Enable debug logs

Both the VS Code Extension and the GitLab Language Server provide logs that can help you troubleshoot. To enable debug logging:

  1. In VS Code, on the top bar, go to Code > Preferences > Settings.
  2. On the top right corner, select Open Settings (JSON) to edit your settings.json file.
  3. Add this line, or edit it if it already exists:

    "gitlab.debug": true,
    
  4. Save your changes.

View log files

To view debug logs from either the VS Code Extension or the GitLab Language Server:

  1. Use the command GitLab: Show Extension Logs to view the output panel.
  2. In the upper right corner of the output panel, select either GitLab Workflow or GitLab Language Server from the dropdown list.

Error: 407 Access Denied failure with a proxy

If you use an authenticated proxy, you might encounter an error like 407 Access Denied (authentication_failed):

Request failed: Can't add GitLab account for https://gitlab.com. Check your instance URL and network connection.
Fetching resource from https://gitlab.com/api/v4/personal_access_tokens/self failed

GitLab Duo Code Suggestions does not support authenticated proxies. For the proposed feature, see issue 1234 in the extension’s project.

Configure self-signed certificates

To use self-signed certificates to connect to your GitLab instance, configure them using these settings. These settings are community contributions, because the GitLab team uses a public CA. None of the fields are required.

Prerequisites:

Setting name Default Information
gitlab.ca null Deprecated. See the SSL setup guide for more information on how to set up your self-signed CA.
gitlab.cert null Unsupported. See epic 6244. If your self-managed GitLab instance requires a custom certificate or key pair, set this option to point to your certificate file. See gitlab.certKey.
gitlab.certKey null Unsupported. See epic 6244. If your self-managed GitLab instance requires a custom certificate or key pair, set this option to point to your certificate key file. See gitlab.cert.
gitlab.ignoreCertificateErrors false Unsupported. See epic 6244. If you use a self-managed GitLab instance with no SSL certificate, or have certificate issues that prevent you from using the extension, set this option to true to ignore certificate errors.

Disable code suggestions

Code completion is enabled by default. To disable it:

  1. In VS Code, on the left sidebar, select Extensions > GitLab Workflow.
  2. Select Manage () > Extension Settings.
  3. In GitLab > Duo Code Suggestions, clear Enable GitLab Duo Code Suggestions.

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:

  1. In VS Code, on the top bar, go to Code > Settings > Settings.
  2. On the top right corner, select Open Settings (JSON) to edit your settings.json file:

    The icons on the top right corner of VS Code, including 'Open Settings.'

  3. In your settings.json file, add this line, or set it to false it already exists:

    "gitlab.featureFlags.streamCodeGenerations": false,
    
  4. Save your changes.

Error: Direct connection fails

History

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. To fix the problem, see the troubleshooting guide for Code Suggestions.

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.

HTTPS project cloning works but SSH cloning fails

This problem happens in VS Code when your SSH URL host or path is different from your HTTPS path. The GitLab Workflow extension uses:

  • The host to match the account that you set up.
  • The path to get the namespace and project name.

For example, the VS Code extension’s URLs are:

  • SSH: git@gitlab.com:gitlab-org/gitlab-vscode-extension.git
  • HTTPS: https://gitlab.com/gitlab-org/gitlab-vscode-extension.git

Both have the gitlab.com and gitlab-org/gitlab-vscode-extension path.

To fix this problem, check if your SSH URL is on a different host, or if it has extra segments in a path. If either is true, you can manually assign a Git repository to a GitLab project:

  1. In VS Code, on the left sidebar, select GitLab Workflow ().
  2. Select the project marked (no GitLab project), then select Manually assign GitLab project: Assign GitLab project manually
  3. Select the correct project from the list.

For more information about simplifying this process, see issue 577 in the gitlab-vscode-extension project.

Error: can't access the OS Keychain

Error messages like these can occur on both MacOS and Ubuntu:

GitLab Workflow can't access the OS Keychain.
If you use Ubuntu, see this existing issue.
Error: Cannot get password
at I.$getPassword (vscode-file://vscode-app/snap/code/97/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:1712:49592)

For more information about these errors, see:

MacOS workaround

A workaround exists for MacOS:

  1. On your machine, open Keychain Access and search for vscodegitlab.gitlab-workflow.
  2. Delete vscodegitlab.gitlab-workflow from your keychain.
  3. Remove the corrupted account from VS Code using the GitLab: Remove Account from VS Code command.
  4. To add the account again, run either Gitlab: Add Account to VS Code or GitLab: Authenticate to GitLab.com.

Ubuntu workaround

When VS Code is installed with snap in Ubuntu 20.04 and 22.04, it can’t read passwords from the OS keychain that extension versions 3.44.0 and later use for secure token storage.

A workaround exists for Ubuntu users who use versions of VS Code earlier than 1.68.0:

  • You can downgrade the GitLab Workflow extension to version 3.43.1.
  • You can install VS Code from the .deb package, rather than snap:
    1. Uninstall the snap VS Code.
    2. Install VS Code from the .deb package.
    3. Go to Ubuntu’s Password & Keys, find the vscodegitlab.workflow/gitlab-tokens entry, and remove it.
    4. In VS Code, run Gitlab: Remove Your Account to remove the account with missing credentials.
    5. To add the account again, run either Gitlab: Add Account to VS Code or GitLab: Authenticate to GitLab.com.

If you use VS Code version 1.68.0 or later, re-installation might not be possible. However, you can still run the last three steps to re-authenticate.