Post
Share your knowledge.
I got error Error executing transaction
Error executing transaction 'GAxnfGdiSoHW3E2DpWWZVCN5mB3CSMrLagTKsbVyVXNg': 1st command aborted within function '0x0000000000000000000000000000000000000000000000000000000000000001::ascii::string' at instruction 8 with code 65536
see: https://suiscan.xyz/mainnet/tx/GAxnfGdiSoHW3E2DpWWZVCN5mB3CSMrLagTKsbVyVXNg
- Sui
Answers
8When encountering an error while calling an entry function in Sui, several common issues can be the cause. Incorrect Function Signature or Arguments: The most frequent reason for an entry function call to fail is a mismatch between the arguments provided and the function's expected signature. This includes incorrect data types, an incorrect number of arguments, or arguments in the wrong order. Ensure the types and order of your arguments precisely match the entry fun definition in your Move module. Insufficient Gas: Executing transactions on the Sui network requires gas fees. If the provided gas budget is insufficient to cover the computation costs of the entry function call, the transaction will fail with an "insufficient gas" error. Increase the gas budget in your transaction call. Invalid Object IDs or Permissions: If your entry function interacts with specific objects, ensure the provided object IDs are correct and that the calling address has the necessary permissions (e.g., ownership, shared object access) to interact with those objects. Module or Function Visibility Issues: Confirm that the target module is published and the entry function is correctly declared as public entry fun. If the function is not entry, it cannot be called directly as an entry point for a transaction. Runtime Errors within the Move Code: The error might originate from the logic within the entry function itself. This could involve arithmetic overflows, attempts to access non-existent data, or violations of Move's type or ownership rules. Examine the Move code for potential runtime errors or panics. Network or RPC Issues: Less commonly, the error could be related to connectivity problems with the Sui network or issues with the RPC endpoint you are using to submit the transaction. Verify your network connection and the RPC URL. To diagnose the specific error, carefully examine the error message returned by the Sui client or SDK. These messages often provide valuable clues about the nature of the failure. You can also use the Sui Explorer or command-line tools to inspect the transaction's status and any associated error details.
Root Cause
This error occurs when:
- Invalid ASCII Data: You're passing non-ASCII characters to
0x1::ascii::string - Empty/Malformed String: Trying to create an empty string or one with invalid bytes
How to Fix
-
Validate Input Strings:
// In your Move function use std::ascii; let str = ascii::string(b"Valid-ASCII-Only"); // Must be pure ASCII -
Check String Arguments:
// In your TS code tx.moveCall({ target: `0xYOUR_PACKAGE::module::function`, arguments: [ tx.pure("ASCII_ONLY_123"), // No emojis/special chars // ... ] }); -
Common Pitfalls:
- ✅ Allowed:
"abc123-_.@" - ❌ Fails:
"üñîçødê こんにちは"
- ✅ Allowed:
Debug Steps
- Check the failing input with:
sui client tx-block GAxnfGdiSoHW3E2DpWWZVCN5mB3CSMrLagTKsbVyVXNg --show-input - Test ASCII conversion separately:
module test { use std::ascii; public entry fun test_string(s: vector<u8>) { let _ = ascii::string(s); // Will abort if invalid } }
The error you're seeing occurred in the ascii::string function and failed with abort code 65536, which typically means you're trying to convert a byte array that contains invalid ASCII characters into a string.
Here’s a breakdown of what likely went wrong:
Reason for the error
The ascii::string function in Move expects all bytes to be valid ASCII values (0–127).
If the byte array contains a non-ASCII byte (like a value >127 or something invalid), it aborts with 65536.
How to fix it
-
Double-check the bytes you're passing to ascii::string.
-
Print or log the byte array before calling the function to confirm it contains only valid ASCII characters.
-
If you're constructing the byte array from input or external data (like a wallet, off-chain service, etc.), sanitize it before passing into Move.
Example in Move:
// This will fail if invalid_bytes contains non-ASCII
let s = ascii::string(invalid_bytes); // Aborts with 65536
The ascii::string function is strict—only clean ASCII bytes allowed. Review the exact data passed at that point in your transaction, and validate it to avoid the abort.
The error you're encountering stems from the use of the ascii::string function in the Move standard library. This function converts a byte array into a string but requires that every byte in the array be a valid ASCII character. ASCII values range from 0 to 127, and any byte outside this range will cause the function to abort. The error code 65536 specifically indicates that one or more bytes are not valid ASCII characters. This can occur if you're passing in raw data or bytes derived from external sources without validating their format.
To resolve this, inspect the byte array you’re passing to ensure all values fall within the ASCII range. You can use logging or debugging tools to print the byte contents before conversion. If you're generating the bytes programmatically, make sure you're not unintentionally including Unicode or binary data. Sanitizing your input at the source is a good practice to prevent these types of issues. Always validate and clean user or off-chain input before calling strict functions like ascii::string in Move modules.
The error is caused by the ascii::string function trying to convert non-ASCII bytes into a string. This function only accepts bytes with values between 0 and 127. If any byte in the array is outside that range, it will abort with error code 65536. To fix this, ensure the input byte array only contains valid ASCII characters. Validate or sanitize the input before passing it into ascii::string.
The error (code 65536) means your transaction failed in the ascii::string function, likely due to:
- Invalid ASCII Input – The string contains non-ASCII characters (e.g., emojis, UTF-8).
- Format Issue – Wrong encoding or length (e.g., empty string).
How to Fix:
✔ Validate Input – Ensure the string is pure ASCII (letters, numbers, basic symbols).
✔ Check Docs – Review ascii::string constraints in the Move module.
Example:
// Correct: ASCII-only
ascii::string(b"Hello123");
// Wrong: Non-ASCII
ascii::string(b"Hello🔥");
Next Step:
- Inspect your input string in the failing transaction.
The error you encountered during the transaction execution:
“1st command aborted within function
0x1::ascii::stringat instruction 8 with code 65536”
means that the transaction failed while trying to process an ASCII string operation, specifically within the ascii::string function from the Sui standard library.
What this means for you:
You're likely passing a non-ASCII string (e.g. one containing emojis, accented letters like é, or symbols outside the standard ASCII range) to a function expecting strict ASCII characters only. The ascii::string function enforces that all characters must be valid 7-bit ASCII (values 0–127), and anything beyond that will cause the transaction to abort with error 65536, which represents an invalid character.
How to fix it:
Double-check the string you're passing into the transaction. Make sure it contains only ASCII characters like:
- A–Z
- a–z
- 0–9
- Basic punctuation and whitespace
If you’re constructing a string in TypeScript or Rust before sending it in the transaction, sanitize it first:
In JavaScript:
function isAscii(str) {
return /^[\x00-\x7F]*$/.test(str);
}
Example: Safe Usage in Move
use sui::ascii;
public fun store_ascii_name(name: vector<u8>) {
let validated = ascii::string(&name); // This will abort if name contains non-ASCII
// continue using validated string
}
If you're using Move CLI or SDK, ensure you use ascii::string() only on safe strings. Avoid passing direct user input without checking.
Learn More:
Do you know the answer?
Please log in and share it.
Sui is a Layer 1 protocol blockchain designed as the first internet-scale programmable blockchain platform.
- How to Maximize Profit Holding SUI: Sui Staking vs Liquid Staking616
- Why does BCS require exact field order for deserialization when Move structs have named fields?65
- Multiple Source Verification Errors" in Sui Move Module Publications - Automated Error Resolution55
- Sui Move Error - Unable to process transaction No valid gas coins found for the transaction419
- Sui Transaction Failing: Objects Reserved for Another Transaction410