LayerZeroFault
EVM & JSON-RPC CODE: STF / 0x Reviewed & Verified:

Uniswap Error TRANSFER_FROM_FAILED (STF) Swap Revert Resolution

Verified by Victor Vance • Lead Technical Analyst & Systems Researcher
Quick Diagnostic Answer (Executive Summary) GSC Snippet Verified

Uniswap error "TRANSFER_FROM_FAILED" (often abbreviated as "STF") is thrown by Uniswap V2/V3 pair pools, Router02, and Universal Router contracts when an IERC20.transferFrom call returns false or reverts. This error occurs when the user has not granted sufficient allowance to the Uniswap router, lacks the necessary token balance, or is attempting to swap a fee-on-transfer token without using specialized swapExactTokensForTokensSupportingFeeOnTransferTokens router functions. Grant approval or adjust slippage settings.

# Root Cause & Technical Architecture

Inside `TransferHelper.sol` or `SafeTransferLib`, Uniswap wraps standard ERC-20 transfers with: `require(success && (data.length == 0 || abi.decode(data, (bool))), "STF")`. If a token contract returns `false` (standard for failure in older ERC-20 tokens), reverts due to zero allowance, or fails due to address blacklists or deflationary fee deductions that reduce received amounts below expectations, the helper reverts with `STF`.

# 4-Step Actionable Diagnostic Protocol

Step-by-Step Resolution
01

Verify Token Allowance to Exact Uniswap Router Address

Ensure you have approved the active router (e.g. Universal Router or Permit2), not an older deprecated router contract address.

02

Check Token Balance Against Input Amount

Confirm the user's wallet holds the entire amountIn plus any potential transfer fees before calling the swap function.

03

Use SupportingFeeOnTransferTokens Functions for Tax Tokens

For tokens with transaction taxes, use swapExactTokensForTokensSupportingFeeOnTransferTokens to accommodate balance deductions during transfer.

04

Inspect Permit2 Nonce and Signature Validity

On Uniswap V3/Universal Router, check that the Permit2 signature did not expire or collide with an already-used permit nonce.

# Diagnostic Verification Code / Command

solidity
uniswap-stf-helper.sol
// Uniswap V3 TransferHelper: The Origin of "STF" Reverts
library TransferHelper {
    function safeTransferFrom(address token, address from, address to, uint256 value) internal {
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value)
        );
        // If transfer fails or returns false -> Reverts with "STF"!
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF');
    }
}
Zero-Secrets Client Sandbox

Launch ERC-4337 UserOp Decoder

Execute client-side cryptographic simulation and parameter checks safely in your browser via native WebCrypto without sending private keys or mnemonics over the wire.

Open Sandbox →
Comprehensive In-Depth Guide

Read Full Investigation & Recovery Workflow

Explore complete architectural diagrams, edge-case failure trees, and detailed post-mortem analysis in our verified deep guide.

Read Guide →

# Related Diagnostic Codes in EVM & JSON-RPC

Related Hex Statuses

# Frequently Asked Questions

FAQ Schema

What does "STF" stand for in Uniswap error messages?

STF is the short 3-letter abbreviation used in Uniswap smart contracts for "SafeTransferFrom Failed".

Why do tax or reflection tokens always fail with STF?

Tax tokens take a fee on transfer, meaning the Uniswap pool receives fewer tokens than specified in the input parameter, violating the transfer invariant.

Can STF happen if gas limit is set too low?

Yes. If the gas allocated to the inner transferFrom call runs out, the call returns false, causing TransferHelper to revert with STF.