Troubleshooting

Solutions to common issues when using the Opinion CLOB SDK.

Installation Issues

ImportError: No module named 'opinion_clob_sdk'

Problem:

import opinion_clob_sdk
# ModuleNotFoundError: No module named 'opinion_clob_sdk'

Solutions:

  1. Install the SDK:

    pip install opinion_clob_sdk
  2. Verify installation:

    pip list | grep opinion
    python -c "import opinion_clob_sdk; print(opinion_clob_sdk.__version__)"
  3. Check Python environment:

    which python  # Ensure correct Python interpreter
    which pip     # Ensure pip matches Python
  4. Use virtual environment:

    python3 -m venv venv
    source venv/bin/activate
    pip install opinion_clob_sdk

Dependency Conflicts

Problem:

Solutions:

  1. Create fresh virtual environment:

  2. Upgrade pip:

  3. Force reinstall:


Configuration Issues

InvalidParamError: chain_id must be 56

Problem:

Solution: Use BNB Chain Mainnet 56


Missing Environment Variables

Problem:

Solutions:

  1. Create .env file:

  2. Load environment variables:

  3. Provide defaults:


API Errors

OpenApiError: errno != 0

Problem:

Solutions:

  1. Always check errno:

  2. Common errno codes:

    Code
    Meaning
    Solution

    0

    Success

    Proceed with result

    404

    Not found

    Check ID exists

    400

    Bad request

    Check parameters

    401

    Unauthorized

    Check API key

    500

    Server error

    Retry later or contact support

  3. Wrap in try-except:


InvalidParamError: market_id is required

Problem:

Solution: Always provide required parameters:


Trading Errors

InvalidParamError: Price must be positive for limit orders

Problem:

Solution: Set valid price for limit orders:


InvalidParamError: makerAmountInBaseToken is not allowed for market buy

Problem:

Solution: Use correct amount field:

Market BUY:

Market SELL:


InvalidParamError: makerAmountInQuoteToken must be at least 1

Problem:

Solution: Use minimum amount of 1:

Blockchain Errors

BalanceNotEnough

Problem:

Solutions:

  1. Check balance:

  2. For merge - need both outcome tokens:


InsufficientGasBalance

Problem:

Solution: Add ETH to signer wallet:


Problem:

Common Causes:

  1. Insufficient approval:

  2. Insufficient balance: Check balance before operation (see BalanceNotEnough above)

  3. Gas price too low:

  4. Contract state changed:


Performance Issues

Too Many API Calls

Problem: Hitting rate limits.

Solutions:

  1. Use caching:

  2. Fetch once, use multiple times:

  3. Paginate efficiently:


Data Issues

Precision Errors

Problem:

Solution: Use safe_amount_to_wei():


Type Mismatch

Problem:

Solution: Use correct types:


Authentication Issues

401 Unauthorized

Problem:

Solutions:

  1. Check API key:

  2. Verify key format:

  3. Contact support: If key is correct but still failing, contact [email protected]


Private Key Issues

Problem:

Solutions:

  1. Check format:

  2. Verify length:


Debug Tips

Enable Logging

Inspect Responses

Check SDK Version

Verify Network Connection


Getting Help

If you're still experiencing issues:

  1. Check FAQ: Frequently Asked Questions

When reporting issues, include:

  • SDK version

  • Python version

  • Full error traceback

  • Minimal code to reproduce

  • Expected vs actual behavior

Last updated