Description
The DLMM.getAllLbPairPositionsByUser() method throws an error when trying to fetch positions for certain wallets:
Cannot read properties of undefined (reading 'feeAmountXPerTokenStored')
This appears to happen when the SDK tries to compute fees on positions where internal state properties are not initialized.
Steps to Reproduce
import { DLMM } from '@meteora-ag/dlmm';
import { Connection, PublicKey } from '@solana/web3.js';
const connection = new Connection('https://api.mainnet-beta.solana.com');
const wallet = new PublicKey('DRpaJDurGtinzUPWSYnripFsJTBXm4HG7AC3LSgJNtNB');
const allPositions = await DLMM.getAllLbPairPositionsByUser(connection, wallet);
Expected Behavior
The method should successfully return all positions for the wallet, or handle positions with missing fee state gracefully.
Actual Behavior
The method throws an error and crashes:
Cannot read properties of undefined (reading 'feeAmountXPerTokenStored')
Environment
- SDK Version: Latest (as of October 2025)
- Network: Solana Mainnet-Beta
- Connection: Standard RPC
Root Cause Analysis
The error suggests that the SDK is trying to access computed fee getters (likely positionData.feeX or positionData.feeY) which internally reference feeAmountXPerTokenStored. This property doesn't exist or isn't initialized for all positions returned by the batch fetch.
Suggested Fix
- Add null/undefined checks before accessing fee-related computed properties
- Make fee getters return
null or 0 when internal state isn't initialized rather than throwing
- Add try-catch blocks around fee computations during position parsing
Workaround
Currently, there's no clean workaround other than:
- Catching the error and handling it gracefully by returning empty results
- Manually fetching position accounts using
connection.getProgramAccounts() and parsing them without the SDK
Impact
This bug prevents users from fetching all positions for certain wallets, making the batch position fetching functionality unusable in production environments where you can't control which wallets will be queried.
Description
The
DLMM.getAllLbPairPositionsByUser()method throws an error when trying to fetch positions for certain wallets:This appears to happen when the SDK tries to compute fees on positions where internal state properties are not initialized.
Steps to Reproduce
Expected Behavior
The method should successfully return all positions for the wallet, or handle positions with missing fee state gracefully.
Actual Behavior
The method throws an error and crashes:
Environment
Root Cause Analysis
The error suggests that the SDK is trying to access computed fee getters (likely
positionData.feeXorpositionData.feeY) which internally referencefeeAmountXPerTokenStored. This property doesn't exist or isn't initialized for all positions returned by the batch fetch.Suggested Fix
nullor0when internal state isn't initialized rather than throwingWorkaround
Currently, there's no clean workaround other than:
connection.getProgramAccounts()and parsing them without the SDKImpact
This bug prevents users from fetching all positions for certain wallets, making the batch position fetching functionality unusable in production environments where you can't control which wallets will be queried.