Vue Solana normalizes common wallet, RPC, address, transaction, timeout, and storage failures into SolanaError.
Use stable error.code values for UI decisions. Keep error.cause for debugging and logs.
Error Shape
import { SolanaError } from "@vue-solana/core/errors";
const error = new SolanaError("RPC_FAILURE", "Unable to reach RPC");
SolanaError includes:
code: stable machine-readable error code.message: human-readable developer message.cause: optional original error from a wallet, RPC call, parser, timeout, or storage operation.feature: optional wallet feature name for unsupported capability errors.
Stable Error Codes
NO_WALLET_SELECTED: no active wallet is selected.WALLET_NOT_CONNECTED: the active wallet is not connected or has no public key.WALLET_FEATURE_UNSUPPORTED: the active wallet does not support the requested feature.WALLET_FAILURE: a wallet-side operation failed without a more specific code — connect/disconnect, persisted-wallet auto-connect, mobile-wallet registration, iOS callback handling, message signing, sign-in, or batch signing.USER_REJECTED: the user rejected a wallet request.INVALID_SIGNATURE: a wallet returned a message or sign-in signature that does not match its account key.INVALID_ADDRESS: an address string could not be parsed as a Solana address.INVALID_INPUT: a helper received a malformed endpoint, timeout, or option value.TRANSACTION_TIMEOUT: a transaction-related operation timed out.TRANSACTION_NOT_FOUND: a signature never appeared in RPC status results before the confirmation deadline.TRANSACTION_FAILED: a submitted transaction errored before reaching the requested commitment.REDIRECT_TIMEOUT: an iOS wallet did not redirect back to the app in time.DECRYPTION_FAILED: an iOS wallet callback could not be decrypted or decoded.MISSING_CLIENT_CAPABILITY: the Kit client lacks a capability a composable requires (for exampleplanTransaction,sendTransaction, orpayer). Usually a hand-built client that skippedcreateSolanaClient()or the matching Kit plugin.RPC_FAILURE: an RPC send, read, or confirmation failed.STORAGE_FAILURE: browser storage could not be read or written.
Core Error Handling
Use isSolanaError() when catching unknown failures.
import { isSolanaError } from "@vue-solana/core/errors";
try {
await signAndSendTransaction(client, wallet, transaction);
} catch (error) {
if (isSolanaError(error)) {
console.log(error.code);
console.debug(error.cause);
}
}
Use normalizeSolanaError() when writing your own framework-agnostic helper that should follow Vue Solana's error model.
import { normalizeSolanaError } from "@vue-solana/core/errors";
async function loadData() {
try {
return await client.rpc.getLatestBlockhash().send();
} catch (cause) {
throw normalizeSolanaError(cause, "RPC_FAILURE", "Unable to load blockhash");
}
}
normalizeSolanaError() maps common wallet rejection shapes to USER_REJECTED.
Vue Error Refs
Vue composables expose error refs.
<script setup lang="ts">
import { computed, watchEffect } from "vue";
import { useBalance } from "@vue-solana/vue/useBalance";
const { error } = useBalance("PASTE_A_SOLANA_ADDRESS");
const message = computed(() => {
switch (error.value?.code) {
case "INVALID_ADDRESS":
return "Enter a valid Solana address.";
case "RPC_FAILURE":
return "Unable to load data from RPC.";
default:
return null;
}
});
watchEffect(() => {
if (error.value?.cause) {
console.debug("Original Solana error", error.value.cause);
}
});
</script>
Nuxt Error Refs
Nuxt auto-imported composables expose the same error model.
<script setup lang="ts">
const { error, execute } = useSolanaSignAndSendTransaction();
const message = computed(() => {
switch (error.value?.code) {
case "NO_WALLET_SELECTED":
return "Choose a wallet first.";
case "USER_REJECTED":
return "The wallet request was rejected.";
case "TRANSACTION_TIMEOUT":
return "The transaction is taking longer than expected.";
case "RPC_FAILURE":
return "The Solana RPC request failed.";
default:
return null;
}
});
</script>
User-Facing Messages
Do not show raw cause details directly to end users unless your app explicitly trusts that source. Wallet and RPC error messages may contain provider-specific text that is confusing or unsafe for UI.
Map stable error codes to short app-specific messages instead.
function getSolanaErrorMessage(code: string) {
switch (code) {
case "USER_REJECTED":
return "Request canceled.";
case "WALLET_FEATURE_UNSUPPORTED":
return "This wallet does not support that action.";
case "RPC_FAILURE":
return "Network request failed. Try again.";
default:
return "Something went wrong.";
}
}
Retry Guidance
- Retry
RPC_FAILUREonly when the operation is safe to repeat. - After
TRANSACTION_TIMEOUT, check signature status before retrying. - Do not retry
USER_REJECTEDautomatically. - Do not retry
INVALID_ADDRESS; ask the user to correct input. - Hide or disable actions that produce
WALLET_FEATURE_UNSUPPORTED.
Diagnosing A Failed Transaction
When you already have a failed history item, a simulation result, or a normalized error, buildDiagnosticReport() from @vue-solana/core/diagnostics joins them into one explainable object. The builder is pure and RPC-free: it does not fetch a transaction, decode instructions, interpret a memo, categorize token transfers, or retry anything.
import { buildDiagnosticReport } from "@vue-solana/core/diagnostics";
const report = buildDiagnosticReport({
historyItem: failedItem,
simulationResult: preview,
error,
feeBudget,
labels: { [programAddress]: "My program" },
});
console.log(report.summary, report.code, report.suggestions);
report always has summary, code, outcome, signature, slot, logs, balanceChanges, unitsConsumed, feeBudget, programs, sources, and suggestions. Common SolanaError codes and raw RPC error keys produce stable suggestions; other codes pass through unchanged. programs comes from Program <address> lines in simulation logs and uses only labels your app supplies — the library ships no program registry.
In Vue, useTransactionDiagnostics() takes a reactive signature or history item and exposes report, status, error, and refresh():
<script setup lang="ts">
import { useTransactionDiagnostics } from "@vue-solana/vue/useTransactionDiagnostics";
const { report, status, error, refresh } = useTransactionDiagnostics(failedItemRef, {
simulationResult: simulationResultRef,
error: errorRef,
feeBudget: budgetRef,
labels: { [programAddress]: "My program" },
});
await refresh();
</script>
In Nuxt, call useSolanaTransactionDiagnostics() without an import. Malformed input reports INVALID_INPUT; the builder itself never reaches the network. See Transactions for the history and simulation inputs.