Skip to content

[🚫 Bug] Getting error SessionNotCreatedError: session not created: probably user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir when browser #1840

Open
@peternhale

Description

@peternhale

Describe the bug

Getitng error with starting tests on Ubuntu/node 22

SessionNotCreatedError: session not created: probably user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir

I am create a framework around vscode-extension-tester to simplify the work my team needs to do to setup a multi-extension test run.

I am setting these vars in GH action so I have predictable locations to archive artifacts generated during the test

TEST_RESOURCES: test-resources-${{ github.run_id }}
EXTENSIONS_FOLDER: extensions-${{ github.run_id }}

The directories are created in GH actions just before the npm run test is run.

I have extended the ExTester to allow for extension installation, etc.
constructor

  constructor(
    testConfig?: Partial<TestConfig>,
    private spec?: string | string[] | undefined
  ) {
    // Create config with defaults and overrides
    const config = createDefaultTestConfig(testConfig);

    // Validate config and set defaults for missing values
    validateTestConfig(config);

    // Set up the VS Code download location as a sibling directory to workspace
    const workspaceDir = path.dirname(config.testResources);
    const vscodeDownloadDir = path.join(workspaceDir, 'vscode');
    super(config.extensionsFolder, ReleaseQuality.Stable, normalizePath(vscodeDownloadDir));
    this.testConfig = config;
  }

I start the tests via

    const useExistingProject = EnvironmentSettings.getInstance().useExistingProject;
    const resources = useExistingProject ? [useExistingProject] : [];
    return super.runTests(this.spec || EnvironmentSettings.getInstance().specFiles, { resources });

I see the following in the logs

Created VS Code directory: vscode
Downloading VS Code: 1.99.2 / stable
Downloading VS Code from: https://update.code.visualstudio.com/latest/linux-x64/stable
progress: 0/163 (0%)
progress: 148557070/148557070 (100%)
Downloaded VS Code into /home/runner/work/<redacted>/extensions-14390011958/stable.tar.gz
Unpacking VS Code into /home/runner/work/<redacted>/extensions-14390011958
Success!
Downloading ChromeDriver 132.0.6834.159 from: https://storage.googleapis.com/chrome-for-testing-public/132.0.6834.159/linux64/chromedriver-linux64.zip
progress: 0/9270115 (0%)
progress: 9270115/9270115 (100%)
Unpacking ChromeDriver 132.0.6834.159 into /home/runner/work/<redacted>/extensions-14390011958
Success!
No vsix files were found in dir /home/runner/work/<redacted>/extensions-14390011958, skipping extension installation
Checking if org with matching alias and username is already authenticated...
running CLI command org:list --json
Command finished with exit code 0
No existing authenticated org found: Error: matching devHub alias 'vscodeOrg' and devHub user name '***' was not found.
Please consult README.md and make sure DEV_HUB_ALIAS_NAME and DEV_HUB_USER_NAME are set correctly.
Authenticating using SFDX_AUTH_URL...
running CLI command org:login:sfdx-url -d -f authFile.txt
Command finished with exit code 0
running CLI command alias:set vscodeOrg=***
Command finished with exit code 0
Loading mocha configuration from /home/runner/work/<redacted>/.mocharc.json


Writing code settings to /home/runner/work/<redacted>/extensions-14390011958/settings/User/settings.json
Launching browser...
  1) "before all" hook in "{root}"
  2) "after all" hook in "{root}"

  0 passing (2s)
  2 failing

  1) "before all" hook in "{root}":
     SessionNotCreatedError: session not created: probably user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir
      at Object.throwDecodedError (node_modules/selenium-webdriver/lib/error.js:521:15)
      at parseHttpResponse (node_modules/selenium-webdriver/lib/http.js:524:13)
      at Executor.execute (node_modules/selenium-webdriver/lib/http.js:456:28)
      at process.processTicksAndRejections (node:internal/process/task_queues:105:5)

Steps to reproduce

See above

Logs

Created VS Code directory: vscode
Downloading VS Code: 1.99.2 / stable
Downloading VS Code from: https://update.code.visualstudio.com/latest/linux-x64/stable
progress: 0/163 (0%)
progress: 148557070/148557070 (100%)
Downloaded VS Code into /home/runner/work/<redacted>/extensions-14390011958/stable.tar.gz
Unpacking VS Code into /home/runner/work/<redacted>/extensions-14390011958
Success!
Downloading ChromeDriver 132.0.6834.159 from: https://storage.googleapis.com/chrome-for-testing-public/132.0.6834.159/linux64/chromedriver-linux64.zip
progress: 0/9270115 (0%)
progress: 9270115/9270115 (100%)
Unpacking ChromeDriver 132.0.6834.159 into /home/runner/work/<redacted>/extensions-14390011958
Success!
No vsix files were found in dir /home/runner/work/<redacted>/extensions-14390011958, skipping extension installation
Checking if org with matching alias and username is already authenticated...
running CLI command org:list --json
Command finished with exit code 0
No existing authenticated org found: Error: matching devHub alias 'vscodeOrg' and devHub user name '***' was not found.
Please consult README.md and make sure DEV_HUB_ALIAS_NAME and DEV_HUB_USER_NAME are set correctly.
Authenticating using SFDX_AUTH_URL...
running CLI command org:login:sfdx-url -d -f authFile.txt
Command finished with exit code 0
running CLI command alias:set vscodeOrg=***
Command finished with exit code 0
Loading mocha configuration from /home/runner/work/<redacted>/.mocharc.json


Writing code settings to /home/runner/work/<redacted>/extensions-14390011958/settings/User/settings.json
Launching browser...
  1) "before all" hook in "{root}"
  2) "after all" hook in "{root}"

  0 passing (2s)
  2 failing

  1) "before all" hook in "{root}":
     SessionNotCreatedError: session not created: probably user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir
      at Object.throwDecodedError (node_modules/selenium-webdriver/lib/error.js:521:15)
      at parseHttpResponse (node_modules/selenium-webdriver/lib/http.js:524:13)
      at Executor.execute (node_modules/selenium-webdriver/lib/http.js:456:28)
      at process.processTicksAndRejections (node:internal/process/task_queues:105:5)

Operating System

ubuntu-latest

Visual Studio Code

latest (1.98.*)

vscode-extension-tester

8.8.1

NodeJS

22

npm

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingquestionFurther information is requested

    Type

    Projects

    Status

    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions