Skip to content

Anchor test error: unsupported program id #4100

@AuroraLantean

Description

@AuroraLantean

Summary: it seems anchor test validator does not terminate before anchor test is run

Error message when I run anchor test:

Error: websocket error

Simulation failed. 
Message: Transaction simulation failed: Error processing Instruction 0: Unsupported program id. 
Logs: 
[
  "Program Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB invoke [1]",
  "Program is not deployed",
  "Program Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB failed: Unsupported program id"
]. 
Catch the `SendTransactionError` and call `getLogs()` on it for full details.

But I have successfully run the same test via running the solana-test-validator + anchor deploy + anchor test --skip-local-validator

My environment

Rustc 1.91.1 (ed61e7d7e 2025-11-07) ... but this is overridden by the `rust-toolchain.toml`: channel = "1.89.0"
solana-cli/agave 3.0.11 (src:edda5bc0; feat:3604001754, client:Agave)
Anchor-cli 0.32.1
TS package(s): 0.32.1
Yarn 1.22.22

solana-cli/agave 3.0.11 is the latest stable for mainnet.
My project is the same as the one you get after running anchor init xyz

Long version of the issue:
When anchor deploy is executed, it must rely on the validator running on another terminal, occupying port 8899.
At this time, the Program should be deployed on the validator.
When the anchor test is executed, the running validator should first be terminated (killed), and then the validator should be restarted to execute the test program;

But if the deployment fails or validator is not completely terminated before anchor test runs, it will result in a port 8899 conflict.
When the anchor test is executed, it will try to deploy the Program in the restarted validator, causing the Program ID to mismatch and causing an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions