Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Solana RPC Client] getAccountInfo returns AccountNotFound for all errors #34585

Closed
NicolasPennie opened this issue Dec 23, 2023 · 1 comment
Closed
Labels
community Community contribution stale [bot only] Added to stale content; results in auto-close after a week.

Comments

@NicolasPennie
Copy link

Problem

The Solana RPC client (rust) returns "AccountNotFound" for any error that happens when making a "getAccountInfo" call. This is misleading. The caller may match their error handling on mistakenly believe an account is closed if they experience a client-side or network error.

This line is executed when the call was successful, but the account does not exist:

RpcError::ForUser(format!("AccountNotFound: pubkey={pubkey}")).into(),

This line is executed for any error, including client-side or network issues:

"AccountNotFound: pubkey={pubkey}: {err}"

Given that the response is identical (minus the error message), consumers may match on "AccountNotFound" in their code which can lead to unexpected behaviour.

Proposed Solution

Only return "AccountNotFound" when getAccountInfo returns successfully with null content (keep line 3957 as-is). Convert L3974 to return RPCRequestError, instead of RPCUserError (e.g. map_err(RpcError::RpcRequestError)? ).

@NicolasPennie NicolasPennie added the community Community contribution label Dec 23, 2023
@NicolasPennie
Copy link
Author

If there are no concerns, I'll put up a PR to adjust this.

@github-actions github-actions bot added the stale [bot only] Added to stale content; results in auto-close after a week. label Dec 23, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Community contribution stale [bot only] Added to stale content; results in auto-close after a week.
Projects
None yet
Development

No branches or pull requests

1 participant