Skip to content

anchor deploy fails with 503 in get_recommended_micro_lamport_fee even when local RPC is healthy #4255

@LixvYang

Description

@LixvYang

Summary

anchor deploy (and therefore anchor test without --skip-deploy) fails early with:

HTTP status server error (503 Service Unavailable) for url (http://127.0.0.1:<rpc-port>/)

Backtrace points to:

  • anchor_cli::get_recommended_micro_lamport_fee
  • anchor_cli::add_recommended_deployment_solana_args

Reproduce

  1. Start a local validator:
solana-test-validator \
  --rpc-port 19899 \
  --faucet-port 19900 \
  --gossip-port 28000 \
  --dynamic-port-range 28001-28080 \
  --ledger /tmp/foracle-issue-ledger3 \
  --reset
  1. Confirm RPC is healthy:
curl -s -X POST -H 'Content-Type: application/json' \
  --data '{"jsonrpc":"2.0","id":1,"method":"getHealth"}' \
  http://127.0.0.1:19899
# => {"jsonrpc":"2.0","result":"ok","id":1}
  1. Run deploy with Anchor 0.32.1:
RUST_BACKTRACE=1 anchor deploy \
  --provider.cluster http://127.0.0.1:19899 \
  --provider.wallet <wallet-path>

Actual behavior

Fails immediately with:

Error: HTTP status server error (503 Service Unavailable) for url (http://127.0.0.1:19899/)

Caused by:
    HTTP status server error (503 Service Unavailable) for url (http://127.0.0.1:19899/)

Stack backtrace:
   0: std::backtrace::Backtrace::capture
   1: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
   2: anchor_cli::get_recommended_micro_lamport_fee
   3: anchor_cli::add_recommended_deployment_solana_args
   4: anchor_cli::deploy

Expected behavior

If RPC is healthy, deploy should continue normally.
If fee recommendation query fails, it should gracefully fall back (or return a precise RPC/method error) instead of aborting with a generic 503.

Notes

  • This blocks anchor test as well (because test triggers deploy).
  • Workaround: pass explicit CU price to bypass auto-recommended fee path:
anchor deploy --provider.cluster http://127.0.0.1:19899 \
  --provider.wallet <wallet-path> \
  -- --with-compute-unit-price 1

Environment

  • anchor-cli 0.32.1
  • solana-cli 3.0.11 (Agave)
  • rustc 1.89.0
  • macOS 14.5 (arm64)

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