> For the complete documentation index, see [llms.txt](https://optim-finance.gitbook.io/optim-finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://optim-finance.gitbook.io/optim-finance/oada-ui/setup/troubleshooting.md).

# Troubleshooting

## Common Issues

1. **Wallet Connection Issues**
   * Ensure you have the wallet extension installed and configured properly
   * Check if the wallet is connected to the correct Cardano network
   * Try refreshing the page or reconnecting the wallet
2. **Transaction Errors**
   * Verify you have sufficient ADA for transaction fees
   * Check wallet UTXOs for conflicts
   * Ensure correct token amounts are specified
3. **CORS Errors**
   * Configure and use `local-cors-proxy` for API requests
   * Ensure your config points to the correct proxy URL
4. **Node Version Incompatibility**
   * Error: "Cannot find module 'node:fs'"
   * Solution: Ensure you're using Node.js v16 or higher
   * To check your Node version: `node --version`
   * To install/update Node.js:

     ```bash
     # Using nvm (Node Version Manager)
     nvm install 16
     nvm use 16

     # Or download directly from nodejs.org
     ```
5. **Dependency Installation Failures**
   * Error: "Failed to install dependencies"
   * Solution: Try clearing npm/yarn cache:

     ```bash
     npm cache clean --force
     # or
     yarn cache clean
     ```
   * If issues persist, try:

     ```bash
     rm -rf node_modules
     rm package-lock.json # or yarn.lock
     npm install # or yarn install
     ```
   * For network issues:

     ```bash
     # Configure npm to use a different registry
     npm config set registry https://registry.npmjs.org/

     # Or use a different DNS
     npm config set dns_server 8.8.8.8
     ```
6. **Port Already in Use**
   * Error: "Port 3000 is already in use"
   * Solution: Either kill the process using port 3000 or use a different port:

     ```bash
     PORT=3001 npm start
     ```
   * To find and kill the process:

     ```bash
     # On Unix-based systems
     lsof -i :3000
     kill -9 <PID>

     # On Windows
     netstat -ano | findstr :3000
     taskkill /PID <PID> /F
     ```
7. **TypeScript Errors**
   * Error: "Type 'X' is not assignable to type 'Y'"
   * Solution: Check type definitions in `src/types` directory
   * Run type checking: `npm run type-check`
   * Common fixes:

     ```typescript
     // Add type assertion
     const value = someValue as ExpectedType;

     // Use type guard
     if (isExpectedType(someValue)) {
       // TypeScript knows the type here
     }

     // Update type definition
     interface MyType {
       property: string;
     }
     ```
8. **Build Failures**
   * Error: "Failed to compile"
   * Common causes and solutions:
     * Syntax errors: Check for missing semicolons, brackets
     * Missing dependencies: Run `npm install` or `yarn install`
     * Type errors: Run `npm run type-check`
     * Memory issues: Increase Node.js memory limit:

       ```bash
       export NODE_OPTIONS=--max-old-space-size=4096
       ```
