Getting Started

Troubleshooting

Common issues and solutions for AI Developer Assistant

Troubleshooting

This guide covers common issues you might encounter when using AI Developer Assistant and their solutions.

Installation Issues

Command Not Found

Problem: ai-dev command is not recognized

bash: ai-dev: command not found

Solutions:

  1. Check if installed globally:
npm list -g kg6-codex
  1. Reinstall globally:
npm install -g kg6-codex
  1. Check PATH:
echo $PATH
which ai-dev
  1. Use npx instead:
npx ai-dev --help

Permission Denied

Problem: Permission errors when running commands

EACCES: permission denied, access '/usr/local/lib/node_modules'

Solutions:

  1. Fix npm permissions:
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
  1. Use npx:
npx ai-dev review
  1. Install locally:
npm install kg6-codex
./node_modules/.bin/ai-dev review

Configuration Issues

No LLM Provider Available

Problem: Error when trying to use AI features

Error: No LLM provider configured

Solutions:

  1. Check configuration:
ai-dev config show
  1. Set environment variables:
export LLM_PROVIDER="gemini"
export GEMINI_API_KEY="your-api-key"
  1. Create configuration file:
cp ai-dev.config.yaml ai-dev.config.local.yaml
# Edit with your settings
  1. Use CLI options:
ai-dev review --llm-provider openai --openai-api-key your-key

Invalid API Key

Problem: API key authentication fails

Error: Invalid API key provided

Solutions:

  1. Verify API key:
# Test OpenAI
curl -H "Authorization: Bearer $OPENAI_API_KEY" https://api.openai.com/v1/models

# Test Gemini
curl -H "x-goog-api-key: $GEMINI_API_KEY" https://generativelanguage.googleapis.com/v1beta/models
  1. Check key format:
    • OpenAI: Should start with sk-
    • Gemini: Should start with AIza
  2. Regenerate API key:

Configuration File Errors

Problem: YAML syntax errors in configuration

Error: Invalid YAML syntax in ai-dev.config.local.yaml

Solutions:

  1. Validate YAML syntax:
ai-dev config validate
  1. Check indentation:
    • Use 2 spaces (not tabs)
    • Maintain consistent indentation
  2. Reset configuration:
cp ai-dev.config.yaml ai-dev.config.local.yaml

Git Integration Issues

Git Repository Not Found

Problem: Git operations fail

Error: Not a git repository

Solutions:

  1. Initialize git repository:
git init
  1. Navigate to git repository:
cd /path/to/your/git/repo
  1. Specify repository path:
ai-dev review --git-repo-path /path/to/repo

Git Authentication Issues

Problem: GitHub integration fails

Error: Git authentication failed

Solutions:

  1. Set GitHub token:
export GITHUB_TOKEN="your-github-token"
  1. Configure git credentials:
git config --global user.name "Your Name"
git config --global user.email "your-email@example.com"
  1. Use SSH instead of HTTPS:
git remote set-url origin git@github.com:user/repo.git

LLM Provider Issues

OpenAI API Issues

Problem: OpenAI API errors

Error: OpenAI API request failed

Solutions:

  1. Check API key and organization:
export OPENAI_API_KEY="your-key"
export OPENAI_ORGANIZATION="your-org-id"  # if applicable
  1. Check rate limits:
    • Wait before retrying
    • Check your OpenAI usage limits
  2. Try different model:
ai-dev review --llm-model gpt-3.5-turbo

Ollama Connection Issues

Problem: Cannot connect to Ollama

Error: Cannot connect to Ollama at http://localhost:11434

Solutions:

  1. Start Ollama service:
ollama serve
  1. Check if Ollama is running:
curl http://localhost:11434/api/tags
  1. Pull a model:
ollama pull llama2
  1. Check port:
ai-dev review --ollama-base-url http://localhost:11434

Gemini API Issues

Problem: Gemini API errors

Error: Gemini API request failed

Solutions:

  1. Check API key:
export GEMINI_API_KEY="your-key"
  1. Verify model availability:
ai-dev review --llm-model gemini-pro
  1. Check quota limits:

File Pattern Issues

No Files Found

Problem: File patterns don't match any files

Warning: No files found matching pattern

Solutions:

  1. Check current directory:
pwd
ls -la
  1. Use absolute paths:
ai-dev review --file-patterns "/absolute/path/to/files/**/*.ts"
  1. Check pattern syntax:
# Correct patterns
ai-dev review --file-patterns "src/**/*.ts"
ai-dev review --file-patterns "*.{js,ts,jsx,tsx}"

Permission Denied on Files

Problem: Cannot read files

Error: Permission denied reading file

Solutions:

  1. Check file permissions:
ls -la filename
chmod 644 filename
  1. Run with appropriate user:
sudo -u your-user ai-dev review

Output Issues

No Output Generated

Problem: Commands run but produce no output

Solutions:

  1. Enable verbose mode:
ai-dev review --verbose
  1. Check file content:
ai-dev review --file-patterns "test-file.js"
  1. Use different output format:
ai-dev review --output-format json

Output Format Issues

Problem: Output formatting errors

Error: Invalid output format

Solutions:

  1. Use supported formats:
ai-dev review --output-format console
ai-dev review --output-format markdown
ai-dev review --output-format json
  1. Check file permissions for output:
ai-dev review --output-path /path/to/output.md

Performance Issues

Slow Response Times

Problem: Commands take too long to complete

Solutions:

  1. Use smaller file patterns:
ai-dev review --file-patterns "src/utils/**/*.ts"  # Instead of "src/**/*.ts"
  1. Exclude large directories:
ai-dev review --exclude-patterns "node_modules/**,dist/**,build/**"
  1. Use faster models:
ai-dev review --llm-model gpt-3.5-turbo  # Instead of gpt-4

Memory Issues

Problem: Out of memory errors

Solutions:

  1. Process smaller files:
ai-dev review --file-patterns "src/**/*.ts" --exclude-patterns "**/*.min.js"
  1. Increase Node.js memory:
node --max-old-space-size=4096 $(which ai-dev) review

Getting Help

Debug Information

When reporting issues, include:

# Version information
ai-dev --version
node --version
npm --version

# Configuration (without sensitive data)
ai-dev config show

# System information
uname -a

Enable Debug Mode

# Enable detailed logging
ai-dev review --verbose --debug

# Save logs to file
ai-dev review --verbose 2>&1 | tee ai-dev.log

Community Support

  1. Check existing issues:
  2. Join the community:
  3. Create a new issue:
    • Include debug information
    • Describe steps to reproduce
    • Include relevant logs
Most issues can be resolved by checking configuration, updating dependencies, or using the correct command syntax. When in doubt, start with ai-dev --help for command-specific guidance.