> ## Documentation Index
> Fetch the complete documentation index at: https://docs-apexspriteai.reliatrack.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Fix common ApexSpriteAI connection and configuration errors

> Fix the most frequent ApexSpriteAI problems including connection errors, authentication failures, model loading issues, and MCP tool errors.

Most ApexSpriteAI problems fall into a small number of categories: network connectivity between Claude Code and LM Studio, misconfigured environment variables, Tailscale routing failures, MCP registration errors, and hardware resource exhaustion when loading large models. Work through the relevant section below to isolate and fix your issue. Each section describes how to diagnose the problem, then provides the exact steps to resolve it.

<AccordionGroup>
  <Accordion title="Connection refused when Claude Code contacts LM Studio">
    **Symptoms:** Claude Code returns an error such as `ECONNREFUSED`, `connect ECONNREFUSED 100.82.56.40:1234`, or `Failed to connect to localhost:1234`.

    **Diagnosis:**

    Run a direct port check from your terminal:

    ```bash theme={null}
    nc -vz 100.82.56.40 1234
    ```

    If this fails, the issue is at the network or server layer, not in Claude Code itself.

    **Fixes:**

    1. **Confirm LM Studio is running.** Open LM Studio and switch to the **Local Server** tab. The server status must show green. Click **Start Server** if it is stopped.

    2. **Check the port.** The default port is `1234`. If you changed it in LM Studio, update `ANTHROPIC_BASE_URL` in `~/.claude/config.json` to use the new port number.

    3. **Set the bind address to `0.0.0.0`.** If Claude Code runs on a different machine from LM Studio, LM Studio must bind to `0.0.0.0` rather than `127.0.0.1`. In LM Studio, open **Local Server → Bind Address** and change the value, then restart the server.

    ```bash theme={null}
    # Confirm the port is now open
    nc -vz 100.82.56.40 1234
    # Expected: Connection to 100.82.56.40 port 1234 [tcp/*] succeeded!
    ```
  </Accordion>

  <Accordion title="Claude Code is still connecting to Anthropic's cloud">
    **Symptoms:** Requests succeed but responses come from Anthropic's API, you are billed for cloud usage, or you receive an Anthropic authentication error when you have no active subscription.

    **Diagnosis:**

    Check whether `ANTHROPIC_BASE_URL` is set in your current shell session:

    ```bash theme={null}
    echo $ANTHROPIC_BASE_URL
    ```

    If the output is empty, the environment variable is not active.

    **Fixes:**

    1. **Verify `~/.claude/config.json` contains the correct value:**

    ```bash theme={null}
    cat ~/.claude/config.json
    ```

    You should see:

    ```json theme={null}
    {
      "env": {
        "ANTHROPIC_BASE_URL": "http://100.82.56.40:1234"
      }
    }
    ```

    2. **If you set it in your shell profile, reload the profile:**

    ```bash theme={null}
    source ~/.zshrc
    echo $ANTHROPIC_BASE_URL
    ```

    3. **Check for a typo.** The URL must not have a trailing slash and must not include the `/v1/messages` path. The correct format is `http://<ip>:<port>` only.

    <Note>
      The shell environment variable takes precedence over `config.json`. If you have both set, make sure neither one contains a stale Anthropic URL.
    </Note>
  </Accordion>

  <Accordion title="Tailscale connectivity issues">
    **Symptoms:** `nc -vz` fails, Claude Code times out, or you can reach LM Studio from the GPU server itself but not from your Mac.

    **Diagnosis:**

    Check Tailscale status on your Mac:

    ```bash theme={null}
    tailscale status
    ```

    The Spark server should appear in the list with a green connected indicator. If it shows as offline, reconnect Tailscale before continuing.

    **Fixes:**

    1. **Reconnect Tailscale** on both machines if either shows as offline. On macOS, click the Tailscale menu bar icon and select **Connect**.

    2. **Verify the Tailscale IP.** Run the following on your GPU server to confirm its current IP:

    ```bash theme={null}
    tailscale ip -4
    ```

    Update `ANTHROPIC_BASE_URL` in your config if the IP has changed.

    3. **Test reachability with netcat:**

    ```bash theme={null}
    nc -vz <tailscale-ip> 1234
    ```

    4. **Check firewall rules on the Spark server.** Port 1234 must not be blocked by the host firewall. On Linux, check with:

    ```bash theme={null}
    sudo iptables -L INPUT -n | grep 1234
    ```

    5. **Confirm LM Studio is bound to `0.0.0.0`**, not `127.0.0.1`. Even with Tailscale working, a `127.0.0.1` bind address blocks all remote requests.
  </Accordion>

  <Accordion title="MCP tool not found or command not available">
    **Symptoms:** Claude Code reports that an MCP server failed to start, the tool is unavailable, or the command was not found.

    **Diagnosis:**

    Inspect the current MCP configuration:

    ```bash theme={null}
    cat ~/.claude/config.json
    ```

    Check whether the `mcpServers` entry exists and whether the `command` field points to an executable that is available in your `PATH`.

    **Fixes:**

    1. **Re-register the MCP server.** Remove the existing entry and add it again:

    ```bash theme={null}
    claude mcp remove <server-name>
    claude mcp add <server-name> <command> [args...]
    ```

    For example:

    ```bash theme={null}
    claude mcp add filesystem npx -y @modelcontextprotocol/server-filesystem ~/projects
    ```

    2. **Confirm the command exists.** If the MCP server uses a binary (not `npx`), verify it is installed and on your `PATH`:

    ```bash theme={null}
    which <command-name>
    ```

    Install the package if the command is missing, then re-register the MCP server.

    3. **Check Node.js is installed** if the MCP server uses `npx`:

    ```bash theme={null}
    node --version
    npx --version
    ```

    <Tip>
      MCP tools execute locally on your Mac regardless of where the LM Studio backend runs. A Tailscale or network issue does not affect MCP tool execution directly.
    </Tip>
  </Accordion>

  <Accordion title="Model fails to load in LM Studio">
    **Symptoms:** LM Studio shows an error when loading a model, the loading progress bar stalls, or the application crashes.

    **Diagnosis:**

    Check how much unified memory or VRAM is currently in use. On macOS with Apple Silicon:

    ```bash theme={null}
    vm_stat
    ```

    On the Spark server (Linux + NVIDIA):

    ```bash theme={null}
    nvidia-smi
    ```

    Compare free memory against the model's expected memory footprint at your chosen quantization level.

    **Fixes:**

    1. **Close other memory-intensive applications** before loading a large model. Browser tabs, open IDE windows, and other AI tools all compete for the same memory pool.

    2. **Reduce the context window size.** A context window of 64k requires significantly more memory than 32k. Lower the context length in **Model Settings** and try loading again.

    3. **Switch to a smaller or more aggressively quantized model.** If Qwen2.5-Coder-32B at Q8 fails to load, try Q4 quantization, or drop to a 16B model such as DeepSeek-Coder-V2-Lite.

    4. **Restart LM Studio** to release memory held by a previously loaded model before loading a new one.

    <Warning>
      Running a 70B model on hardware with less than 64 GB of unified memory will result in heavy CPU offloading and very slow inference. Always check the model card for minimum memory requirements before downloading.
    </Warning>
  </Accordion>

  <Accordion title="DNS resolution failures on macOS">
    **Symptoms:** Hostnames that previously resolved correctly stop working, you can connect by IP address but not by hostname, or network changes do not take effect.

    **Diagnosis:**

    Attempt to resolve the hostname manually:

    ```bash theme={null}
    nslookup <hostname>
    ```

    If the response contains a stale or incorrect IP, the DNS cache needs to be cleared.

    **Fixes:**

    Flush the macOS DNS cache:

    ```bash theme={null}
    sudo killall -HUP mDNSResponder
    ```

    Then retry the resolution:

    ```bash theme={null}
    nslookup <hostname>
    ```

    If you need to query a specific DNS server directly to compare results:

    ```bash theme={null}
    nslookup <hostname> <dns-server-ip>
    ```

    <Warning>
      Flushing the DNS cache affects all active network connections on your machine. Close network-sensitive applications before running this command.
    </Warning>
  </Accordion>
</AccordionGroup>
