Skip to content
SOLTidy

Close Solana program buffers to recover SOL from deploys

A failed Solana deploy leaves a buffer holding about 0.52 SOL per 100 KB. Find it with solana program show --buffers and close it to get every lamport back.

Cover image for Close Solana program buffers to recover SOL from deploys
By 10 min read 2196 words

Key takeaways

  • A Solana program buffer is an account owned by the BPF Upgradeable Loader that stages your program binary during a deploy; an interrupted deploy leaves it on chain with its full rent deposit.
  • As of November 2026, the Solana CLI funds a new buffer with (128 + 45 + program bytes) x 5,080 lamports, about 0.521 SOL for a 100 KiB program and 5.33 SOL for a 1 MiB program.
  • solana program show --buffers lists the buffers your default keypair controls, and solana program close --buffers closes all of them and returns every lamport for the network fee only.
  • The solana CLI prints a 12-word seed phrase at the start of every deploy; recover it with solana-keygen recover and pass the file to solana program deploy --buffer to resume instead of paying rent twice.
  • SOLTidy's Buffer & ALT Closer finds buffers by their authority with one getProgramAccounts query and closes those your connected wallet controls, for 5% of the SOL recovered.

The short answer

A failed or interrupted Solana program deploy leaves a buffer account on chain holding the rent for your entire program, about 0.521 SOL per 100 KiB and 5.33 SOL per MiB as of November 2026. Run solana program show --buffers to list them and solana program close --buffers to close them all; every lamport returns to your wallet for the network fee only. If you would rather finish the deploy, recover the buffer keypair from the seed phrase the CLI printed and pass it to solana program deploy --buffer.

What is a Solana program buffer account?

A program buffer is an account owned by the BPF Upgradeable Loader (BPFLoaderUpgradeab1e11111111111111111111111) that holds your compiled program while it is being uploaded. A single Solana transaction is limited to 1,232 bytes, so a program of a few hundred kilobytes cannot be sent in one go. The CLI breaks the deploy into stages:

  1. Create the buffer. One transaction creates the account and funds it with the rent-exempt minimum for the full program size.
  2. Write the binary. Hundreds or thousands of small Write transactions copy the .so file into the buffer, chunk by chunk.
  3. Deploy or upgrade. A final transaction tells the loader to move the bytes into the program's data account. The loader drains the buffer's lamports to the payer, funds the program data account, and the buffer is gone.

If step 3 never happens, the buffer stays exactly where it is, with its full deposit. Nothing in Phantom, Solflare or Backpack shows it, because it is not a token account. You only notice that your balance dropped by a few SOL.

In the loader's source, a buffer's header is 37 bytes: a 4-byte type tag (1 means Buffer), a 1-byte flag saying whether an authority is set, and the 32-byte buffer authority. The program bytes follow. The buffer authority is the only key that can write to the buffer or close it, and by default it is the keypair you deployed with, usually ~/.config/solana/id.json.

How much SOL is locked in a program buffer?

A buffer holds the rent-exempt minimum for the program data account it is meant to become, which is (128 + 45 + program bytes) x 5,080 lamports at today's rate. The Agave CLI deliberately funds the buffer with the program data account's rent (45-byte header) rather than the buffer's own (37-byte header), so the final step does not need extra SOL. I measured these with getMinimumBalanceForRentExemption against mainnet on November 4, 2026:

Program sizeBuffer deposit today (5,080 lamports/byte)Buffer created before the rent cut (6,960 lamports/byte)
100 KiB (102,400 bytes)0.52107 SOL0.71391 SOL
200 KiB1.04126 SOL1.42661 SOL
300 KiB1.56145 SOL2.13932 SOL
500 KiB2.60184 SOL3.56472 SOL
1 MiB (1,048,576 bytes)5.32764 SOL7.29929 SOL

An account keeps the lamports it was created with, so a buffer abandoned before Solana lowered rent still holds the larger amount and returns all of it when closed. For any other size, the Solana rent calculator applies the live rate. The wider picture, including token accounts, stake accounts and lookup tables, is in the rent-exempt minimum by account type.

Do you need twice the program size in SOL to deploy?

No, not with a current CLI. The "2x" rule comes from older versions: up to Solana 1.17, --max-len defaulted to "twice the length of the original deployed program", so the program data account was reserved at double size. Since 1.18 the default is "the length of the original deployed program", and the Agave 4.x CLI keeps that. Because the loader refunds the buffer to the payer before funding the program data account, a fresh deploy needs roughly one program's worth of rent plus fees, not two. You only pay twice when a failed attempt leaves a buffer behind and the retry creates a new one.

Why do Solana program deploys fail?

Deploys fail for the same reasons ordinary transactions fail, multiplied by the number of transactions involved: a 500 KiB program needs hundreds of writes, and every one has to land. The common causes:

  • Insufficient funds. The CLI checks your balance first and stops with Account <address> has insufficient funds for spend (<n> SOL) + fee (<n> SOL). That check happens before the buffer exists, so it costs nothing. Running out partway through a retry loop is what strands SOL.
  • Dropped writes during congestion. Write transactions that never land leave holes in the buffer. The CLI re-signs with a fresh blockhash up to --max-sign-attempts times (5 by default) and then gives up with Data writes to account failed.
  • No priority fee. Without --with-compute-unit-price, writes compete at the base fee and are the first to be dropped when blocks are full. Setting a price in micro-lamports per compute unit fixes most stalls; the Solana priority fee tracker shows current levels and how much priority fee to pay explains the trade-off.
  • A closed terminal, lost connection or Ctrl+C. The buffer is left in whatever state the last write left it.
  • Wrong program keypair or authority. An upgrade signed by the wrong upgrade authority fails at the last step, after the buffer is fully written and funded.

For the error strings themselves and how to read the logs, see why Solana transactions fail. Anchor users are not exempt: anchor deploy in Anchor 0.32 shells out to solana program deploy, so the same buffers and the same commands apply.

How do you find and close program buffers with the Solana CLI?

Use solana program show --buffers to list them and solana program close --buffers to close them; both default to your configured keypair as the authority. These are the commands that matter, from the Agave CLI's own help text:

CommandWhat it does
solana program show --buffersLists every buffer whose authority is your default keypair, with its balance
solana program show --buffers --buffer-authority <ADDRESS>Lists buffers for a different authority
solana program show --buffers --allLists buffers for all authorities
solana program close --buffersCloses all buffers that match the authority and withdraws their lamports
solana program close <BUFFER_ADDRESS>Closes one buffer
solana program close --buffers --authority <KEYPAIR> --recipient <ADDRESS>Closes buffers owned by another keypair and sends the SOL elsewhere
solana-keygen recover -o buffer-keypair.jsonRebuilds the buffer's keypair from the printed seed phrase
solana program deploy --buffer buffer-keypair.json <PROGRAM.so>Resumes a deploy into the existing buffer
solana program close <PROGRAM_ID> --bypass-warningPermanently closes a deployed program and returns its program data rent

The step-by-step version for a typical "my deploy died" situation:

  1. Check the cluster: solana config get. A devnet buffer will not show up while you point at mainnet, and the reverse.
  2. Run solana program show --buffers. If the list is empty, you probably deployed with another keypair; add --buffer-authority <ADDRESS>.
  3. Decide per buffer: resume it (next section) or close it.
  4. Run solana program close --buffers to close all of them, or solana program close <BUFFER_ADDRESS> for one.
  5. Confirm with solana balance. The loader's Close instruction moves the buffer's entire balance to the recipient, which defaults to your keypair.

Closing a buffer never touches a deployed program. A live program executes from its program data account, so the only thing you lose is the partly uploaded bytes. The full reference is in the Solana docs on deploying programs.

How do you resume a failed deploy with the seed phrase?

Recover the buffer's keypair from the 12-word phrase and pass it back to the deploy command, so the CLI keeps writing into the buffer you already paid for. The CLI prints this phrase at the start of every deploy that does not use an existing buffer, precisely so a crash is recoverable. The message in the Agave source reads "Recover the intermediate account's ephemeral keypair file with solana-keygen recover and the following 12-word seed phrase", followed by "To resume a deploy, pass the recovered keypair as the [BUFFER_SIGNER] to solana program deploy or solana program write-buffer".

  1. Scroll back in your terminal (or CI log) to the block between the ==== lines and copy the 12 words.
  2. Run solana-keygen recover -o buffer-keypair.json, paste the phrase, and press Enter at the passphrase prompt. The phrase is generated with an empty passphrase.
  3. Check that solana address -k buffer-keypair.json matches the buffer from solana program show --buffers.
  4. Run the same deploy again with --buffer buffer-keypair.json added, ideally with a priority fee this time.
  5. When it succeeds, the buffer is consumed and its lamports pay for the program data account. Delete the recovered keypair file.

If you have lost the phrase, you cannot resume, but you can still close the buffer: closing needs only the buffer authority, not the buffer's own keypair. The same message ends with exactly that fallback, solana program close <BUFFER_ADDRESS>.

How does SOLTidy's Buffer & ALT Closer work?

I built the Buffer & ALT Closer for developers who deploy from a browser wallet, a hardware wallet or a machine without the Solana toolchain. It does the same thing as solana program close --buffers, and this is how, from the code:

  • Finding buffers. It runs one getProgramAccounts call against the BPF Upgradeable Loader with a memcmp filter on the first 37 bytes: the Buffer tag 1, the "authority is set" flag 1, then your 32-byte address. Every buffer you control comes back in a single request, with no data downloaded.
  • Any authority, read-only. You can paste any deployer address to see its buffers and their SOL balances without connecting anything. Closing is only possible for buffers whose authority is the connected wallet.
  • What it closes. For each selected buffer it builds the loader's Close instruction (instruction index 5) with three accounts: the buffer, the recipient and the authority as signer. The recipient is always your connected wallet. Closes are packed into as few transactions as fit, and you approve each transaction in your wallet.
  • The fee. Each transaction adds a plain SOL transfer of 5% of the lamports closed in that transaction, so every transaction pays only for its own buffers. Recovering 2.6 SOL from a 500 KiB buffer costs 0.13 SOL.

The honest comparison: if you have the CLI installed and the deployer keypair file on hand, solana program close --buffers is free apart from the network fee, and I would use it. The browser tool is worth the 5% when the authority lives in a wallet extension or on a Ledger, or when you want to check several team addresses quickly without touching key files. If your buffers belong to a CLI keypair, the read-only lookup still tells you how much is recoverable before you decide.

The same tool also closes address lookup tables, which need a deactivate step and a short cool-down first; that process is covered in how to close Solana address lookup tables.

Should you close a deployed program to recover its SOL?

Only if nobody will ever call it again, because closing a program is irreversible. solana program close <PROGRAM_ID> --bypass-warning closes the program data account and returns its rent, roughly the same amount as a buffer of the same size. Without the flag, the CLI refuses and prints: "WARNING! Closed programs cannot be recreated at the same program id. Once a program is closed, it can never be invoked again."

Good candidates are old devnet test programs (devnet SOL has no value, but the habit is the same), throwaway mainnet experiments, and programs replaced by a new deployment at a different ID. Bad candidates are anything with users, a frontend, or other programs calling it through CPI. The upgrade authority has to sign, and a program deployed with --final has no upgrade authority, so it can never be closed. If you are tidying up a deployer wallet more broadly, every way to reclaim Solana rent compared covers the token accounts and stake accounts that usually sit next to it.

What changes are coming for program deploys?

As of November 2026, solana program deploy still targets the BPF Upgradeable Loader, also called loader v3, and buffers work as described above. Anza removed the experimental loader-v4 commands from the CLI in March 2026, with loader v4 to be redesigned as an on-chain program per RFC-0423. Two loader-v3 changes are in progress: SIMD-0433 resizes the program data account to fit each upgrade and refunds surplus rent, and SIMD-0685 removes ExtendProgram, which the CLI already marks as deprecated. Neither changes how a stranded buffer is found or closed.

Bottom line

A failed Solana deploy does not burn your SOL; it parks the full rent for your program in a buffer account, about 0.52 SOL per 100 KiB and 5.33 SOL per MiB today, more for buffers created before the rent cut. Resume it with the seed phrase and solana program deploy --buffer if you still want the program, or close it with solana program close --buffers and get every lamport back. If the buffer authority is a browser or hardware wallet, or you just want to see what an address has stranded, the Buffer & ALT Closer scans any authority for free and closes your own buffers for 5% of the SOL recovered. And if your wallet looks light for reasons beyond deploys, why your Solana balance is lower than expected and the free wallet cleanup scan cover the rest.

Questions & answers

Where did my SOL go after a failed solana program deploy?

Almost all of it is sitting in a buffer account. The CLI creates and funds the buffer with the rent for your whole program before it uploads a single byte, so if the deploy stops, the deposit stays there: about 0.52 SOL per 100 KiB today. Only the transaction fees for the write transactions that landed are actually spent. Run solana program show --buffers to see the buffer and solana program close --buffers to get the SOL back.

Is it safe to close a Solana program buffer?

Yes, as long as you no longer want to resume that upload. A deployed program runs from its program data account, not from a buffer, so closing a buffer never affects a live program. Closing does destroy the partly written bytes, so if you plan to finish the deploy, resume it with solana program deploy --buffer instead and the buffer is consumed when the deploy completes.

How do I resume a failed Solana deploy instead of starting over?

Find the 12-word seed phrase the CLI printed at the start of the deploy, run solana-keygen recover -o buffer-keypair.json, enter the phrase and press Enter at the passphrase prompt. Then run solana program deploy --buffer buffer-keypair.json with your program file and program keypair as before. The CLI writes only into the existing buffer, so you do not fund a second one.

Why does solana program show --buffers find nothing?

The command looks for buffers whose authority is your default configured keypair. If you deployed with a different keypair, add --buffer-authority with that address, or use --all to list buffers for every authority. A buffer that was consumed by a successful deploy or already closed no longer exists, and a buffer on devnet will not show up while your CLI points at mainnet.

Can I close a deployed Solana program to get its SOL back?

Yes. solana program close with the program ID and --bypass-warning closes the program data account and sends its rent to you, which is roughly the same amount as a buffer of that size. It is permanent: the CLI warns that closed programs cannot be recreated at the same program ID and can never be invoked again. Only do it for programs nobody calls, such as old devnet tests or abandoned mainnet experiments.

How much does SOLTidy charge to close program buffers?

The Buffer & ALT Closer charges 5% of the SOL it recovers, paid inside the same transaction as the close, plus the normal network fee. Scanning, including read-only lookups of any authority address, is free. If you have the CLI and the deployer keypair at hand, solana program close --buffers does the same job for the network fee alone.