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

# Troubleshooting

> This page is meant to serve as a reference for common issues with Magma / agent development in general!

## Common Issues

### Authentication Issues

If you encounter a `401` error or an error message indicating that you are not authenticated, this likely means your login has expired.

To fix this, run `magma login` again.

If the issue persists, make sure your CLI is up to date by running `magma update`, then try logging in again.

### Tool Issues

If your agent does not seem to be calling your tools as expected, or you're getting an error, check for the following:

* **Most Common**: You're not returning a string from your tool!
  * Even if your tool works and has no errors, it will not work if you don't return a string.
* Each tool takes in the correct arguments - `call: MagmaToolCall`
* Ensure the model you're using is actually *capable* of calling tools! Some aren't!! (e.g. llama-3.3-70b-specdec)
* Tools have to be decorated with `@tool` and/or `@toolparam`

### Deployment Issues

If you encounter deployment issues, check the following:

* Ensure you have a valid `package.json` file in your project root
* Verify you have set up the required API keys in your `.env` file:
  * For OpenAI: `OPENAI_API_KEY`
  * For Anthropic: `ANTHROPIC_API_KEY`
  * For Google: `GOOGLE_API_KEY`
  * For Groq: `GROQ_API_KEY`
* Update your Magma CLI to the latest version:
  ```bash theme={null}
  magma update
  ```
* Update your agent to use the latest version of Magma
  ```bash theme={null}
  npm i @pompeii-labs/magma@latest
  ```
* Try logging in again with:
  ```bash theme={null}
  magma login
  ```

## My issue isn't listed here!

If you're having an issue that isn't listed here, please let us know in our **#issues** channel in the [community Slack](https://magmacommunity.slack.com) and we'll get it sorted out!
