I've followed along with other peoples examples but I keep getting the 0x65 custom program error. I'm using @solana/web3.js, @solana/wallet-adapter-react, @solana/buffer-layout, and js-sha256

const buyTickets = async (programId: PublicKey, user: PublicKey, amount: number, referral: PublicKey) => {
try {
  const [dashboardAccount] = PublicKey.findProgramAddressSync([Buffer.from('dashboard')], programId);
  const dashboardAccountInfo = await connection.getAccountInfo(dashboardAccount);
  const dashboardResponse = DashboardResponse.decode(dashboardAccountInfo!.data);

  const [userdataAccount] = PublicKey.findProgramAddressSync(
    [Buffer.from('dashboard'), publicKey!.toBuffer()],

  const transaction = new Transaction({ feePayer: publicKey! });
  const functionName = 'initializeUserdata';
  const stuff = Buffer.from(
        .update('soltrain:' + functionName)
  const userdataInitializationInstruction = new TransactionInstruction({
    keys: [
        pubkey: userdataAccount,
        isWritable: true,
        isSigner: false,
        pubkey: publicKey!,
        isWritable: true,
        isSigner: true,
        pubkey: SystemProgram.programId,
        isWritable: false,
        isSigner: false,
    data: stuff,
    programId: programId,
  const blockhash = await connection.getLatestBlockhash();
  transaction.recentBlockhash = blockhash.blockhash;
  const signedTransaction = await signTransaction!(transaction);

  // Send the signed transaction
  await connection.sendRawTransaction(signedTransaction.serialize());
  // signTransaction(transaction);
  // sendTransaction(transaction, connection).then((txid) => {
  //   console.log(`Transaction submitted: https://explorer.solana.com/tx/${txid}?cluster=devnet`);
  // });
} catch (error) {
  console.error('Error fetching account data:', error);


1 Answer 1


0x65 means thats there is no fallback function. This means thats your function identifier is wrong. So its searching for a fallback, but there is none defined in the program. I think in your case it should be




depending on how the function is named in your program.

You can find the anchor descriminator implementation here: https://github.com/coral-xyz/anchor/blob/master/lang/attribute/account/src/lib.rs#L93-L107

Since you are using anchor the easier way would be to use the anchor client. This would look something like this:

  import { yourProgram } from "../target/types/yourType";

  const provider = anchor.AnchorProvider.env();

  const program = anchor.workspace.yourProgram as Program<YourProgram>;
  const wallet = provider.wallet as anchor.Wallet;
  const connection = provider.connection;
  const transaction = await program.methods

   const txSig = await sendAndConfirmTransaction(

The types you can find in the target folder after you built the program in the types folder

  • 1
    omfg it was the global:function_name, that was the solution program was developed in anchor
    – FudgyDRS
    Commented Feb 14 at 9:39

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.