C3 AI Documentation Home

C3 AI VS Code Extension Troubleshooting

This topic describes how to troubleshoot common Visual Studio Code Extension (VSCE) issues.

If you're experiencing issues connecting to your environment, or if you're running into issues syncing your package, you should try these initial steps to restore your connection:

  1. Confirm all of the following:

    • Your environment is in a running state
    • You have read and write permissions for your development space
    • Your software versions are up to date. See compatible software versions on the Supported Versions per Release page.
  2. Resync your packages. Right-click your package in VSCE and choose Sync Packages.

  3. If the issues persist, restart VS Code.

The following sections go into more detail about specific issues you may be having.

Reopen extension tab

If you close the VSCE tab, you can open it again with the VS Code Command Palette.

  1. In VS Code, open the Command Palette (CMD + Shift + P on Mac OS, or Ctrl + Shift + P on Windows).
  2. Type in C3: Open Login Page and press Enter.

SSL and certificate issues

If you have trouble connecting to your environment, you may have SSL or certificate issues. The following section provides guidance on troubleshooting your connection and certificate settings to ensure you have a valid connection to your cluster.

Example error code: self signed certificate in certificate chain

Find relevant certificates

To see which certificates you should use, you can open the certificate settings in your browser while accessing Studio. You should be using the Chrome browser.

  1. Navigate to C3 AI Studio homepage for your cluster.

  2. In your browser address bar, select the site information icon.

  3. In the dropdown menu, select Connection is secure to open connection details.

    Browser connection details menu

  4. In the pop-up window, select Certificate is valid.

    Certificate is valid menu item highlighted in menu

  5. Select the Details tab. This tab shows the Certificate Authority for all certificates required to connect to your environment.

    Connection details popup window

Add missing certificates

You can access all certificates in the chain for your cluster using the openssl command. The following example finds the certificates for a training cluster, uses the 443 port, and saves the certificates to cert_chain.txt:

Command Line
openssl s_client -connect stggketrn4.c3training.cloud:443 -showcerts > cert_chain.txt
  1. Save each certificate in its own .pem file. Certificates start with ------BEGIN CERTIFICATE end with END CERTIFICATE-----.
  2. Consult your IT department for a valid outgoing port for your connection.
  3. Add certificates to your system trust store.
    • For Mac OS, run the following code in a CLI to add each certificate to your trust store. For each certificate, replace mycert.pem for each .pem file you saved.

      Text
      sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain mycert.pem

      Then open the Keychain Access application and set the When using this certificate: field to Always Trust for each certificate. See the following screenshot for this step:

      Screenshot of how to trust certificates in Mac OS

    • For Windows, add each certificate using the Certificate Manager application for Windows.

Configure Node to use certificates

After you add missing certificates, specify the path for your certificates for Node.js. Certificate paths are environment variables that you must set in the shell configuration file to ensure that the server consistently uses the certificates when establishing secure connections.

For Mac OS or Linux, run the following in your command line to set the certificate paths. Replace <path_to_cert_chain> with the path to your certificates:

  • bash: run ~/.bashrc export NODE_EXTRA_CA_CERTS="<path_to_cert_chain>
  • zsh: run ~/.zshrc export NODE_EXTRA_CA_CERTS="<path_to_cert_chain>

After you make this change, quit and relaunch the VS Code application. It ss recommended to relaunch the application from a new command line (CLI) window:

Command Line
# Open the current folder in VS code
code .

If you cannot relaunch VS Code from a CLI, quit the application completely (CMD + Q in Mac OS, CTRL + Q in Windows) and then relaunching it.

Ignore certificate checks

If you are still unable to resolve certificate errors for your machine, you may need to ignore certificate checks. This is not recommended as ignoring certificate checks may expose you to security vulnerabilities.

Enter the following commands in a CLI to bypass VS Code certificate checks:

Command Line
# Ignore NODE certificate checks
set NODE_TLS_REJECT_UNAUTHORIZED=0

npm config set strict-ssl false --global

# Ignore VS Code certificate checks
code --ignore-certificate-errors

Server authentication issues

Your connection may fail due to a stale authentication token. You can remove your authentication token using the Command Palette in VS Code:

  1. In VS Code, open the Command Palette (CMD + Shift + P on Mac OS, or Ctrl + Shift + P on Windows).
  2. In the Command Palette, search for and select the command C3: Remove Auth Token.
  3. Type in your environment URL and press Enter.

If the issue persists, set the token manually through VS Code:

  1. From C3 AI Studio, access your environment console.

  2. In C3 AI Console, enter the following command and copy the output to your clipboard:

    JavaScript
    Authenticator.generateActionAuthToken()
  3. In VS Code, open the Command Palette (CMD + Shift + P on Mac, or Ctrl + Shift + P on Windows).

  4. In the Command Palette, search for and select the command C3: Set Auth Token.

  5. Select your environment from the dropdown menu, or enter the environment URL manually.

  6. Paste the generated key from Step 1 into the prompt.

npm package issues

If you encounter npm error ENODATA, you may be missing some required data or metadata, or you may be using an outdated version of Node JS.

  1. Try cleaning your cache. Run the following code in Terminal:

    Command Line
    npm cache clean --force
  2. If you're unable to access npm packages downloaded during runtime installation, you may need to uninstall and reinstall Node.js. Follow the instruction below that matches how you installed Node.js:

    • If you used nvm to install Node.js, use the following command to uninstall:

      Command Line
      nvm uninstall --latest
    • If you used the official installer to install Node.js, use the following command to uninstall:

      Command Line
      sudo rm -rf /usr/local/lib/node_modules /usr/local/include/node /usr/local/bin/node
    • If you used homebrew to install Node.js, use the following command to uninstall:

      Command Line
      brew uninstall node

    For more information, see How to install Node.js in the Node.js documentation.

Local permission issues

If you see Failed to execute npm install or something similar, you may be experiencing permission issues for your machine.

  1. In a CLI, navigate to the local cache for npm. This directory is typically a hidden .npm directory.

    • For Mac, run sudo chown -R 501:20 "/Users/User/.npm" in Terminal to change directory ownership.
    • For Windows, open VS Code as an administrator by right-clicking the application and selecting Run as administrator.

Unreachable environment

Based on your cluster administrative settings, your environment may have automatically hibernated activity. You may need to restart or resume your hibernated environment to resume development.

  1. Navigate to C3 AI Studio in your browser.
  2. Select your environment in the Current environment dropdown.
  3. Select the ellipse (...) next to the environment, and choose Resume environment.
  4. Wait for your environment to resume. When your environment shows a green check mark next to its name, it is in the running state.

Connection fails in air-gapped environment because of Keyring

Keyrings are storage systems that manage sensitive information, such as passwords, tokens, and encryption keys. Connection issues to air-gapped environments can result from incomplete keyring configurations.

For your GNOME Keyring on a Linux machine, you can verify if your GNOME Keyring is installed and running. Contact your customer IT admin for more troubleshooting instructions regarding your GNOME Keyring.

  1. which gnome-keyring-daemon checks if your GNOME Keyring is installed
  2. ps aux | grep gnome-keyring checks if your GNOME Keyring is running

Dev app inaccessible

The Dev application is where the VS Code Extension package launches from. If you can't start your Dev application, you may need to start it manually through the environment Console.

  1. Navigate to C3 AI Studio in your browser.

  2. On the homepage, select your environment in the Current environment dropdown (or confirm it is currently selected).

  3. Navigate to the environment C3 AI Console, and run the following command:

    JavaScript
    DevEnv.ensureDevApp()

Adjust reconnect to network attempts

When VSCE detects the loss of connection, it provides a notification and attempts to reconnect.

If you lose your internet connection, the extension attempts to reconnect five times. Each reconnection attempt lasts 30 seconds.

To change the number of attempts, follow these steps:

  1. Open the VS Code settings (CMD + , for Mac OS, Ctrl + , for Windows).
  2. Search for c3ai.reconnectAttempts in the search bar, or select Extensions > C3 AI.
  3. Under C3ai: Reconnect Attempts, enter your preferred number of reconnect attempts.

Streaming errors

If you see "Failed to stream" errors while trying to sync to environment, it could be that you need to enable streaming after a certain size, or reduce batch size.

JavaScript
// Enable streaming after 10000000 KB (10 GB)
IdeConfig.setConfigValue('maxBufferedWriteFileSize', 10000000); 
IdeConfig.setConfigValue('maxBufferedReadFileSize', 10000000);

// Reduce batch size
IdeConfig.setConfigValue('downloadBatchSize', 100); 
IdeConfig.setConfigValue('upsertBatchSize', 25);

Socket hang up

If you see socket hang up issues, check if you have sym links in your package. Files from the sym links should be located in the root directory of your package, and can't link to other packages.

Example error message: Error: socket hang up

Stale package issues

If you see Java compilation errors or other code-gen issues, you may be experiencing stale Pkg issues. For example, you may see errors that involve declarations of the same Type.

Text
Multiple type declarations with the same name `<TYPE NAME>` were found.

If your metadata changes are not being synced, you may need to manually resync your packages.

To sync your packages, right-click the package you want to sync, and choose Sync Packages.

Force resync all

If you sync your package, but you still notice stale package issues, you can try force resyncing your package.

Note: Force resync all forcibly resyncs and re-validates everything in your package. Save your work appropriately.

  1. While synced to your environment, press CMD + Shift + P on Mac, or Ctrl + Shift + P on Windows to open the Command Palette.
  2. Type in C3: Force Resync All Packages and press Enter.

Contact your IT admin

If you are connecting from a corporate laptop, or if you're connecting to non-C3 hosted cluster, you may need to reach out to your specific company IT admins for additional support in troubleshooting your connection issues.

Examples of configurations that can cause connection issues:

  • Firewall settings
  • VPN settings
  • Network proxies
  • Network security software
  • Cluster whitelists for IP addresses

See also

Was this page helpful?