๐Ÿ”ง Troubleshootingยถ

This guide will help you resolve common issues that you might encounter while using CellMage.

๐Ÿšซ Common Issues & Solutionsยถ

API Connection Issuesยถ

Symptom: Unable to connect to API or Authentication failed errors.

Solutions:

  1. Verify your API key is set correctly:

    %llm_config --status  # Check if API key is set
    
  2. Check that your API base URL is correct if using a custom endpoint:

    %llm_config --api-base https://your-custom-endpoint
    
  3. Check your internet connection and any required VPN settings.

  4. Verify that the service isnโ€™t experiencing an outage.

Missing Personas or Snippetsยถ

Symptom: Persona not found or Snippet not found errors.

Solutions:

  1. Check your persona/snippet directories configuration:

    %llm_config --status  # View configured directories
    
  2. Verify that the persona/snippet exists in the specified directory:

    ls ./llm_personas/  # List available personas
    ls ./llm_snippets/  # List available snippets
    
  3. Try using the absolute path to your persona/snippet:

    %llm --persona /absolute/path/to/persona.md
    

SQLite Storage Issuesยถ

Symptom: Database errors or missing conversations.

Solutions:

  1. Check permissions on the SQLite database file:

    ls -la ~/.cellmage/conversations.db
    
  2. Ensure the directory exists:

    mkdir -p ~/.cellmage
    
  3. Verify database integrity:

    sqlite3 ~/.cellmage/conversations.db "PRAGMA integrity_check;"
    

Integration Authentication Problemsยถ

Symptom: Authentication failed when using Jira, Confluence, GitHub, or GitLab.

Solutions:

  1. Verify that the required environment variables are set:

    import os
    print("JIRA_API_TOKEN set:", bool(os.environ.get("JIRA_API_TOKEN")))
    # Similar for other service tokens
    
  2. Check that URLs are correctly formatted (include https://):

    print(os.environ.get("JIRA_URL"))  # Should start with https://
    
  3. Regenerate your API tokens/PATs if they might have expired.

Kernel Restart Requiredยถ

Symptom: Magic commands not working, incorrect behavior after changing configuration.

Solutions:

  1. Restart the Jupyter kernel:

    Kernel > Restart
    
  2. Reinstall the CellMage extension:

    %reload_ext cellmage
    

Memory Usage Issuesยถ

Symptom: High memory usage or kernel crashes with large prompts.

Solutions:

  1. Use streaming responses to reduce memory footprint:

    %llm --stream "Your prompt here"
    
  2. Reduce context size by being more selective with snippets:

    %llm --clear-snippets  # Clear existing snippets
    
  3. Use smaller models when possible:

    %llm_config --model gpt-4o-mini
    

๐Ÿ› ๏ธ Base Directory Configuration & Migrationยถ

CellMage now supports a single environment variable, CELLMAGE_BASE_DIR, to control the base directory for all working files (personas, snippets, .data, logs, etc.).

  • By default, this is the current working directory.

  • To change it, set the environment variable:

    export CELLMAGE_BASE_DIR=/path/to/your/project
    
  • All working files will be created/accessed under this directory.

  • To migrate, move your existing llm_personas, llm_snippets, .data, and cellmage.log into the new base directory.

Backward Compatibility: If CELLMAGE_BASE_DIR is not set, CellMage will continue to use the current working directory as before.

๐Ÿ“ Debugging Tipsยถ

Enable Debug Loggingยถ

To get more detailed logs:

import logging
from cellmage.utils.logging import setup_logging
setup_logging(level=logging.DEBUG)

Logs will be written to cellmage.log in your working directory.

Inspect API Requestsยถ

To see the exact requests being sent to the LLM API:

%llm_config --debug-mode True

This will print the full request and response objects to the log.

Check Token Usageยถ

To monitor your token usage:

%llm_stats  # Shows token usage statistics

๐Ÿ†˜ Getting Helpยถ

If youโ€™re still encountering issues:

  1. Check our GitHub Issues to see if your problem has been reported.

  2. Create a new issue with:

    • A minimal reproducible example

    • Your environment details (OS, Python version, etc.)

    • Full error messages and logs

    • Steps youโ€™ve already tried

Our magical community will do its best to help you resolve the issue!