Skip to content

MultipleSandboxInstancesError with npx ampx sandbox #2856

@SanjoSolutions

Description

@SanjoSolutions

Environment information

System:
  OS: Windows 11 10.0.22631
  CPU: (32) x64 AMD Ryzen 9 3950X 16-Core Processor
  Memory: 14.12 GB / 47.92 GB
Binaries:
  Node: 22.14.0 - ~\AppData\Local\fnm_multishells\40828_1749934395103\node.EXE
  Yarn: undefined - undefined
  npm: 10.9.2 - ~\AppData\Local\fnm_multishells\40828_1749934395103\npm.CMD
  pnpm: 10.12.1 - ~\AppData\Local\fnm_multishells\40828_1749934395103\pnpm.CMD
NPM Packages:
  @aws-amplify/ai-constructs: Not Found
  @aws-amplify/auth-construct: Not Found
  @aws-amplify/backend: 1.16.1
  @aws-amplify/backend-ai: Not Found
  @aws-amplify/backend-auth: Not Found
  @aws-amplify/backend-cli: 1.8.0
  @aws-amplify/backend-data: Not Found
  @aws-amplify/backend-deployer: Not Found
  @aws-amplify/backend-function: Not Found
  @aws-amplify/backend-output-schemas: Not Found
  @aws-amplify/backend-output-storage: Not Found
  @aws-amplify/backend-secret: Not Found
  @aws-amplify/backend-storage: Not Found
  @aws-amplify/cli-core: Not Found
  @aws-amplify/client-config: Not Found
  @aws-amplify/data-construct: Not Found
  @aws-amplify/data-schema: Not Found
  @aws-amplify/deployed-backend-client: Not Found
  @aws-amplify/form-generator: Not Found
  @aws-amplify/model-generator: Not Found
  @aws-amplify/platform-core: Not Found
  @aws-amplify/plugin-types: Not Found
  @aws-amplify/sandbox: Not Found
  @aws-amplify/schema-generator: Not Found
  @aws-cdk/toolkit-lib: Not Found
  aws-amplify: 6.14.4
  aws-cdk-lib: 2.195.0
  typescript: 5.8.3
No AWS environment variables
No CDK environment variables

Describe the bug

Hi, I receive very often a MultipleSandboxInstancesError after save:

15:20:00 [ERROR] [MultipleSandboxInstancesError] Multiple sandbox instances detected.
  ∟ Caused by: [_ToolkitError] Other CLIs (PID=53816) are currently reading from ...\.amplify\artifacts\cdk.out.

I have "format on save" with Prettier configured in Visual Studio Code. This seems to trigger two saves in quick succession. I have verified this with Process Monitor:

Image

I have verified that I run npx ampx sandbox only once.

Reproduction steps

I have format on save with Prettier configured in Visual Studio Code. Happens after saving a change to a lambda function handler file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingquestionQuestion or confusion about some aspect of the product

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions