0

I tried example [spl-token-minter] on github.com/solana-developers repo on my local net.

Run anchor run test got error:

  • Error Number: 3009. Error Message: Program account is not executable.
  • Error Number: 3007. Error Message: The given account is owned by a different program than expected

enter image description here

It is less likely that repo code failed to run. But I can not figure out what goes wrong on my side.

1 Answer 1

2

Sounds like from the errors that the Metaplex Metadata program is not deployed on your local validator (yet you are invoking it and using it in your program).

Are you using the same Anchor.toml from the repo?


[test]
startup_wait = 5000
shutdown_wait = 2000

[test.validator]
bind_address = "0.0.0.0"
url = "https://api.mainnet-beta.solana.com"
ledger = ".anchor/test-ledger"
rpc_port = 8899

[[test.validator.clone]]
address = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"

This is basically telling the testing environment to clone the Metadata program from mainnet to your local validator when it starts up (which is necessary to test your program). Without doing this step, your program will throw because Anchor has checks verifying that metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s is executable code.

Here's the Anchor Reference.

3
  • Thank, I also noticed the "test.validator*" section in Anchor.toml. I only modified the 'spl_token_minter' to latest programID. Without reading Anchor.toml Reference before, I took it for granted that local net will prepare all dependent programs for us. Follow your hint, I find that the error reason was: I start 'solana-test-validator' first, then execute anchor run test. Now it success if only start anchor test. So, anchor run test is not the same as anchor test. What's their different? If testing on devnet, do it use these "test.validator*" conf to download program too? Jan 11 at 14:33
  • 1
    You can find all anchor commands with anchor --help. You can find the Anchor CLI Docs here. You don't need to deploy the Metadata program for Devnet testing because the program is already deployed to Devnet.
    – AMilz
    Jan 11 at 16:10
  • Thanks for you help and great patients. Jan 12 at 3:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.