I am trying to fetch newly created PDA(s) of my devnet deployed (anchor) program via solana-cli but I get AccountNotFound.



use anchor_lang::prelude::*;


pub const BOYNC_AUCTION_PDA_SEED: &[u8] = b"auction";

pub mod boync_anchor_program {
    use super::*;

    pub fn initialize(ctx: Context<Initialize>, name: String, token: Pubkey) -> Result<()> {
        if name.as_bytes().len() > 64 {
            return err!(ErrorCode::UserNameTooLong);
        let user_data = &mut ctx.accounts.user_data;

        user_data.name = name;
        user_data.token = token;
        user_data.authority = ctx.accounts.authority.key();


pub struct Initialize<'info> {
    pub authority: Signer<'info>,
        payer = authority,
        space = BOYNC_AUCTION_DATA_LEN,
        seeds = [BOYNC_AUCTION_PDA_SEED.as_ref(), authority.key().as_ref()], 
    pub user_data: Account<'info, BoyncAuctionData>,
    pub system_program: Program<'info, System>,

pub const BOYNC_AUCTION_DATA_LEN: usize = 32 + 32 + (64 + 4) + 8;
pub struct BoyncAuctionData {
    pub authority: Pubkey,
    pub token: Pubkey,
    pub name: String, 

pub enum ErrorCode {
    #[msg("User name can only be 64 chars long.")]


  const token: PublicKey = new PublicKey(<some_token_public_key>);
  const [_bobAuctionPDA, _] = await PublicKey

  try {
    const _bobAuctionData = await program.account.boyncAuctionData.fetch(_bobAuctionPDA);
    if (_bobAuctionData != null || typeof _bobAuctionData != "undefined") {
        `[Anchor] Boync Auction with Bob User PDA ${_bobAuctionPDA.toBase58()} already defined:`
  } catch (error) {
    console.log(`[Anchor] Account ${_bobAuctionPDA.toBase58()}, does not exist ... move on to creating it!`);

  const tx = await program.methods
  .initialize('Bob', token)
    authority: anchorProvider.wallet.publicKey,
    userData: _bobAuctionPDA,

  console.log('[Anchor] Done, tx:', tx);


Then fetching the newly created account via:

  const bobAuctionData = await program.account.boyncAuctionData.fetch(bobAuctionPDA);

  console.log('[Anchor] Done.');
  console.log(`Auction Data: { name: ${bobAuctionData.name}, authority: ${bobAuctionData.authority.toBase58()}, token: ${bobAuctionData.token.toBase58()}`);

Everything works perfectly here ^^. I get my account with expected data inside it. Solana explorer finds the account too (but none of it's "account data" such as 'owner' and 'token' fields, what's up with that?)

But if I try to fetch it via: solana account <address> or @solana/web3.js -> connection.getAccountInfo I get AccountNotFound.

What am I missing / doing wrong? Are PDAs special in this regard?

EDIT: Ok, I think that the RPC endpoint spawned by anchor localnet --provider.cluster devnet does not in fact communicate with the devnet but still hangs on to some local instance.

In my Anchor.toml:

seeds = false
boync_anchor_program = "hqgrvUepLLhFbXCb8woduWM62ps5rqap3TmPHbpuK11"

url = "https://anchor.projectserum.com"

cluster = "devnet"
wallet = "/Users/<username>/.config/solana/id.json"

test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
start = "yarn run ts-node app/client/main.ts"

The node script runs fine but I see no instructions passed to my devnet program hence no PDA being created. The functions inside the script:

await program.account.boyncAuctionData.fetch() and await program.methods .initialize() ... seem to work.

I've checked the connection object from my provider and it seem to have the correct rpcEndpoint set:

AnchorProvider]: AnchorProvider {
  connection: Connection {
    _commitment: 'processed',
    _confirmTransactionInitialTimeout: undefined,
    _rpcEndpoint: 'https://api.devnet.solana.com',
    _rpcWsEndpoint: 'wss://api.devnet.solana.com/',
    _rpcClient: ClientBrowser {
      options: [Object],
      callServer: [AsyncFunction (anonymous)]
    _rpcRequest: [Function (anonymous)],
    _rpcBatchRequest: [Function (anonymous)],
    _rpcWebSocket: Client {
      _events: [Events <Complex prototype>],
      _eventsCount: 10,
      webSocketFactory: [Function: _default],
      queue: {},
      rpc_id: 0,
      address: 'wss://api.devnet.solana.com/',
      autoconnect: false,
      ready: false,
      reconnect: true,
      reconnect_interval: 1000,
      max_reconnects: Infinity,
      rest_options: {},
      current_reconnects: 0,
      generate_request_id: [Function (anonymous)]

Why is it that I cannot talk to devnet via anchor-cli? Can I only talk to devnet if I connect to solana-wallet-providers (connect to phantom via front)?


  • 1
    solana account <address> will always return the raw bytes if there is any data on chain. Are you sure you are connected to devnet with the solana cli? Use solana config get. Also, solana explorer does not know how to deserialize your custom owner and token fields, hence they will not show there human readable.
    – Omega
    Commented Jul 18, 2022 at 12:08
  • Thank you. Correct, I now know know that solana explorer doesn't know how to decode arbitrary accounts - makes sense - so scratch that remark. I checked that solana config is correct. I can find my program deployed on devnet however I can't see the invocations via my test script so I will try and dig more in why that may be. Will return with updates. Commented Jul 18, 2022 at 12:39
  • be sure to move the solution out of comments and into an answer once found!
    – trent.sol
    Commented Jul 18, 2022 at 19:07

4 Answers 4


I don't know if it's a bug or not but for me somehow I got stuck with a mismatch cluster in anchor. I still can't invoke a program on devnet with local anchor environment.

  1. Started my local RPC Endpoint to talk to the devnet (or atleast I hope that's the way to do it): anchor localnet --provider.cluster devnet
  2. Deployed to devnet using anchor deploy --provider.cluster devnet
  3. In my Ancor.toml file I had
cluster = "devnet"

I checked and the program did not received any calls from my test node code.

The 2 workarounds I found:

Hope it helps. I would love to know the reason why this happened to me :)


solana account <address> will always return the raw bytes if there is any data on chain. Are you sure you are connected to devnet with the solana cli? Use solana config get.

Also, solana explorer does not know how to deserialize your custom owner and token fields, hence they will not show there human readable.


In your Anchor.toml file,,, Try setting the seeds to true, Then run anchor build again to use the newly created idl

  • 1
    You could improve the quality of this answer by elaborating what you believe the problem to be and why this suggestion might resolve it
    – trent.sol
    Commented Jul 19, 2022 at 19:37
  • I'm not sure what I would accomplish with this but it errors out when building: ``` thread 'main' panicked at 'called Result::unwrap() on an Err value: Error("expected value", line: 1, column: 1)', lang/syn/src/idl/pda.rs:161:56 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace ``` Commented Jul 20, 2022 at 8:09

I have the same issue, I deployed the program already but when I try to initialize the PDA with a new pda seed it says "account does not exist" even though findProgramAddress does return a pubkey, the problem comes from the fetch call

  • you should create your own post rather than abuse answers with "i have this problem too". OP has clearly abandoned their post and it needs replaced with a better one
    – trent.sol
    Commented Jul 25, 2022 at 18:16
  • I'm not sure how your issue is the same as mine but I'll post an answer of the situation I found myself in. Hope it helps. Commented Jul 26, 2022 at 14:01

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.