Skip to content

Conversation

@mikejmorgan-ai
Copy link
Member

@mikejmorgan-ai mikejmorgan-ai commented Dec 9, 2025

Summary

Implements Issue #263: Common errors and solutions guide

This PR adds a comprehensive troubleshooting guide (docs/TROUBLESHOOTING.md) to help users diagnose and fix common issues.

Sections Covered

1. API Key Issues

  • Missing API keys with setup instructions
  • Invalid key format errors
  • Rate limit handling

2. Installation Errors

  • Package not found
  • Dependency problems
  • dpkg lock conflicts
  • Held packages

3. Network & Connectivity

  • DNS resolution failures
  • Connection timeouts
  • SSL certificate issues

4. Permission Problems

  • Permission denied errors
  • Operation not permitted

5. LLM Provider Issues

  • Ollama not running
  • Model not found
  • Context length exceeded

6. Package Manager Conflicts

  • apt process conflicts
  • Snap vs apt issues

7. Performance Issues

  • Slow AI responses
  • High memory usage

8. Rollback & Recovery

  • Undo installations
  • System recovery steps

Additional Features

  • Error Code Reference Table: Quick lookup for common error codes
  • Step-by-step solutions: Copy-paste commands for each issue
  • Community support links: Discord and GitHub resources
  • Verbose/debug instructions: How to gather diagnostic info

Test Plan

  • All code examples are syntactically correct
  • Links are valid
  • Markdown renders correctly
  • Table of contents links work

Files Changed

  • docs/TROUBLESHOOTING.md - New troubleshooting guide (588 lines)

Closes #263

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Added a comprehensive troubleshooting guide with detailed solutions for common issues including installation, API key, network, permissions, and performance problems.
    • Includes error code reference, offline workflows, recovery steps, and resources for debugging and community support.

✏️ Tip: You can customize this high-level summary in your review settings.

Implements Issue #263 - Common errors and solutions guide

This guide helps users diagnose and fix common issues they may
encounter when using Cortex Linux.

Sections covered:
- API Key Issues: missing keys, invalid formats, rate limits
- Installation Errors: package not found, dependencies, dpkg locks
- Network & Connectivity: DNS, timeouts, SSL certificates
- Permission Problems: sudo requirements, file ownership
- LLM Provider Issues: Ollama setup, model selection
- Package Manager Conflicts: apt/snap conflicts
- Performance Issues: slow responses, memory usage
- Rollback & Recovery: undo installations, system recovery

Additional features:
- Quick reference error code table
- Step-by-step solutions for each error
- Links to community support resources
- Verbose mode and logging instructions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 9, 2025

Walkthrough

A comprehensive troubleshooting guide is added to docs/TROUBLESHOOTING.md, documenting common error scenarios across API key, installation, network, permissions, LLM provider, package conflicts, performance, and recovery categories. Each section includes symptoms, verification commands, and corrective actions.

Changes

Cohort / File(s) Change Summary
Documentation
docs/TROUBLESHOOTING.md
Adds comprehensive troubleshooting guide with 8+ error categories, error code reference table, verification commands, solution workflows (including offline/alternative provider modes), verbose mode guidance, log locations, and community support resources.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify accuracy of all provided commands and environment variable syntax
  • Confirm error scenarios and solutions align with current product behavior
  • Check completeness against supported providers and known issues

Poem

🐰 Hop hop! A guide for the weary souls,
When errors strike and circuits stroll,
We've penned the fixes, clear and bright—
No more confusion in the night!

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'docs: Comprehensive Troubleshooting Guide (Issue #263)' clearly and specifically describes the main change: adding a comprehensive troubleshooting guide documentation, directly addressing Issue #263.
Description check ✅ Passed The description covers all required template sections (Summary, Type of Change marked as documentation update, Testing checklist completed) with comprehensive details about the troubleshooting guide content, test plan, and issue closure.
Linked Issues check ✅ Passed The PR fully implements Issue #263 requirements: creates docs/TROUBLESHOOTING.md, covers top error scenarios (API, System, Network, Permission, LLM Provider, Package Manager, Performance, Recovery), includes plain-English explanations with copy-paste commands, and links to community support.
Out of Scope Changes check ✅ Passed All changes are directly in-scope: only docs/TROUBLESHOOTING.md was added to fulfill Issue #263 requirements without unrelated modifications or scope creep.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs/common-errors-guide

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 9, 2025

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (5)
docs/TROUBLESHOOTING.md (5)

23-25: Add language specifiers to symptom code blocks.

Fenced code blocks should specify a language for proper syntax highlighting. Symptom blocks showing error messages should use text as the language identifier.

Apply this diff pattern to all symptom blocks (lines 23, 58, 81 and others):

-**Symptom:**
-```
-Error: No API key found. Set ANTHROPIC_API_KEY or OPENAI_API_KEY environment variable.
-```
+**Symptom:**
+```text
+Error: No API key found. Set ANTHROPIC_API_KEY or OPENAI_API_KEY environment variable.
+```

Repeat for all other symptom sections throughout the document.

Also applies to: 58-60, 81-83


106-108: Symptom blocks need language specifier (recurring pattern).

All error symptom blocks throughout the document should use text language specifier for consistency and proper rendering (see previous comment for pattern).

Also applies to: 136-139, 167-169, 194-197


264-267: Note GUI tool limitation in headless environments.

Line 266 references software-properties-gtk, which is a GUI application unsuitable for headless servers, SSH sessions, or CI/CD automation. Clarify that this solution is for desktop environments only, or provide a CLI alternative.

Add a note above the command or provide an alternative for headless systems:

-2. **Try different mirror:**
+2. **Try different mirror (GUI on desktop systems):**
    ```bash
    sudo software-properties-gtk  # Change download server
    ```
+   
+   Or via command line:
+   ```bash
+   sudo sed -i 's/archive.ubuntu.com/mirror.example.com/g' /etc/apt/sources.list
+   sudo apt update
+   ```

470-505: Restructure Performance Issues section for consistency.

This section lacks the "Symptom:" headers present in all other error sections, making it structurally inconsistent. Additionally, "slow responses" and "high memory usage" are performance optimization tips rather than error troubleshooting (which is the document's primary purpose).

Consider either:

  1. Reframe these as symptoms with corresponding error messages (e.g., "Response takes > X seconds")
  2. Move this section to a separate "Performance Tuning" guide
  3. Keep it as-is but note this is an optimization guide, not error troubleshooting

553-567: Wrap bare URLs in markdown link format.

Lines 561, 565, and 566 contain bare URLs that should be wrapped in angle brackets or converted to proper markdown links for better rendering and accessibility.

Replace bare URLs with markdown formatted links:

-2. Open an issue: https://github.com/cortexlinux/cortex/issues
+2. Open an issue: <https://github.com/cortexlinux/cortex/issues>
 
 ### Community support
 
-- Discord: https://discord.gg/uCqHvxjU83
-- GitHub Discussions: https://github.com/cortexlinux/cortex/discussions
+- Discord: <https://discord.gg/uCqHvxjU83>
+- GitHub Discussions: <https://github.com/cortexlinux/cortex/discussions>

Alternatively, use markdown link syntax:

- [GitHub Issues](https://github.com/cortexlinux/cortex/issues)
- [Discord Community](https://discord.gg/uCqHvxjU83)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f18bc09 and 2b27afa.

📒 Files selected for processing (1)
  • docs/TROUBLESHOOTING.md (1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
docs/TROUBLESHOOTING.md

23-23: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


58-58: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


81-81: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


106-106: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


136-136: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


167-167: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


194-194: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


223-223: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


253-253: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


278-278: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


303-303: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


327-327: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


351-351: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


380-380: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


404-404: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


431-431: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


451-451: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


561-561: Bare URL used

(MD034, no-bare-urls)


565-565: Bare URL used

(MD034, no-bare-urls)


566-566: Bare URL used

(MD034, no-bare-urls)

🔇 Additional comments (4)
docs/TROUBLESHOOTING.md (4)

1-16: Clean structure and comprehensive table of contents.

The document organization is well-structured with a complete TOC and clear section headings. The metadata is minimal but appropriate.

Also applies to: 585-588


298-344: Verify Cortex CLI command flags and syntax.

Line 311 references cortex install docker --execute flag. Confirm this flag exists and has the correct syntax.


570-584: Error Code Reference table is clear and helpful.

The error code mapping provides a quick lookup for common issues. The table is well-organized and aligns with the troubleshooting sections above.


539-551: No action required—documentation is accurate.

Both references are correct:

  • The -v verbose flag is properly implemented in cortex/cli.py (line 817) as --verbose with short form -v
  • The log path ~/.cortex/logs/cortex.log matches the CortexLogger implementation in cortex/logging_system.py (default log directory ~/.cortex/logs and log filename {name}.log where name defaults to cortex)

Comment on lines +240 to +243
3. **Try different DNS:**
```bash
sudo echo "nameserver 8.8.8.8" >> /etc/resolv.conf
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Fix unsafe DNS configuration command.

The shell redirection doesn't work with sudo in this form. The redirect operator (>>) is processed by the current shell before echo executes.

Replace with a command that properly escalates privileges:

-   sudo echo "nameserver 8.8.8.8" >> /etc/resolv.conf
+   echo "nameserver 8.8.8.8" | sudo tee -a /etc/resolv.conf
🤖 Prompt for AI Agents
In docs/TROUBLESHOOTING.md around lines 240 to 243, the example using sudo with
shell redirection is unsafe/incorrect because the shell handles >> before sudo
runs; replace the snippet with a privileged-safe command such as using tee or
running the echo under a root shell (for example use sudo tee -a
/etc/resolv.conf or sudo sh -c 'echo "nameserver 8.8.8.8" >> /etc/resolv.conf'),
and mention that users may need appropriate privileges and to prefer editing
resolv.conf via their distro’s recommended method
(NetworkManager/systemd-resolved) where applicable.

Comment on lines +290 to +294
2. **Check system time (SSL requires correct time):**
```bash
date
sudo ntpdate pool.ntp.org
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Replace deprecated ntpdate with modern time-sync utility.

The ntpdate utility is deprecated and removed from modern Linux distributions (Ubuntu 21.04+, Debian 11+). Use timedatectl instead, which is available on systemd-based systems.

Replace with:

-   sudo ntpdate pool.ntp.org
+   timedatectl  # Check current time and sync status
+   sudo timedatectl set-ntp true  # Enable NTP sync
🤖 Prompt for AI Agents
In docs/TROUBLESHOOTING.md around lines 290–294, replace the deprecated ntpdate
instructions with guidance to use systemd's timedatectl: instruct readers to
enable NTP synchronization via timedatectl, verify the system clock and NTP sync
status with timedatectl status/queries, and advise enabling or starting the
system time synchronization service if not active; update the wording to mention
that timedatectl is available on systemd-based distributions and remove the
ntpdate example.

Comment on lines +346 to +424
## LLM Provider Issues

### Error: "Ollama not running"

**Symptom:**
```
Error: Could not connect to Ollama at localhost:11434
```

**Solutions:**

1. **Start Ollama:**
```bash
ollama serve &
```

2. **Check if running:**
```bash
curl http://localhost:11434/api/tags
```

3. **Install Ollama if missing:**
```bash
curl -fsSL https://ollama.ai/install.sh | sh
```

4. **Pull required model:**
```bash
ollama pull llama2
```

### Error: "Model not found"

**Symptom:**
```
Error: model 'xyz' not found
```

**Solutions:**

1. **List available models:**
```bash
ollama list
```

2. **Pull the model:**
```bash
ollama pull llama2
```

3. **Use a different model:**
```bash
export CORTEX_MODEL=llama2
```

### Error: "Context length exceeded"

**Symptom:**
```
Error: This model's maximum context length is 4096 tokens
```

**Solutions:**

1. **Simplify your request:**
```bash
# Instead of
cortex install "complete development environment with..."

# Try
cortex install "python development tools"
```

2. **Use a model with larger context:**
```bash
export CORTEX_MODEL=claude-3-opus
```

---
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# Search for environment variable definitions and usage
rg -n 'CORTEX_PROVIDER|CORTEX_MODEL|CORTEX_MAX_CONTEXT' --type=py --type=sh --type=js --type=ts

Repository: cortexlinux/Cortex

Length of output: 356


🏁 Script executed:

# Search for CLI command definitions in Python files
rg -n 'def (history|rollback|status|wizard)' --type=py -A 2

Repository: cortexlinux/Cortex

Length of output: 1955


🏁 Script executed:

# Look for click/argparse command decorators
rg -n '@(app\.|click\.|command)' --type=py | head -30

Repository: cortexlinux/Cortex

Length of output: 44


🏁 Script executed:

# Find main CLI entry points
find . -type f -name "*.py" -o -name "*.js" -o -name "*.ts" | xargs grep -l "click\|argparse\|commander" | head -20

Repository: cortexlinux/Cortex

Length of output: 523


🏁 Script executed:

# Look at the cortex/cli.py file to understand which env vars are actually used
cat -n cortex/cli.py | sed -n '60,80p'

Repository: cortexlinux/Cortex

Length of output: 1182


🏁 Script executed:

# Search for all CORTEX_ environment variables in the codebase
rg -n 'CORTEX_' --type=py

Repository: cortexlinux/Cortex

Length of output: 2950


🏁 Script executed:

# Check if CORTEX_MODEL is mentioned anywhere in the codebase
rg -n 'CORTEX_MODEL' -i

Repository: cortexlinux/Cortex

Length of output: 586


Update environment variable documentation for accuracy.

The troubleshooting section references environment variables that don't exist or aren't implemented in the actual Cortex CLI:

  • CORTEX_PROVIDER is correctly implemented and documented
  • CORTEX_MODEL and CORTEX_MAX_CONTEXT are not exposed as user-facing environment variables in the CLI code; CORTEX_MODEL appears only in systemd service files as internal configuration

Remove or replace references to CORTEX_MODEL and CORTEX_MAX_CONTEXT in the troubleshooting guide. The CLI commands (history, rollback, status, wizard) are correctly documented.

🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

351-351: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


380-380: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


404-404: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In docs/TROUBLESHOOTING.md around lines 346 to 424, the doc references
environment variables CORTEX_MODEL and CORTEX_MAX_CONTEXT that are not
user-facing in the CLI; remove those references and any example exports using
them, and either replace them with the supported CORTEX_PROVIDER variable or
reword to instruct users to configure the model/context via the actual
mechanisms (e.g., service configuration/systemd or the provider-specific config)
used by Cortex; ensure examples and solution steps no longer show "export
CORTEX_MODEL=..." or "export CORTEX_MAX_CONTEXT=..." and instead point to the
correct configuration approach or omit those environment-variable suggestions.

Comment on lines +367 to +370
3. **Install Ollama if missing:**
```bash
curl -fsSL https://ollama.ai/install.sh | sh
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

current Ollama installation URL Linux official documentation 2025

💡 Result:

Official Linux install docs: https://docs.ollama.com/linux [1]
Install script URL used there: https://ollama.com/install.sh [2]

Sources:
[1] Ollama — Linux documentation (docs.ollama.com/linux).
[2] Ollama — Download (ollama.com/download/linux).


Update Ollama installation URL to current official domain.

The installation URL at line 369 uses an outdated domain. Change https://ollama.ai/install.sh to https://ollama.com/install.sh per the current official Ollama documentation.

🤖 Prompt for AI Agents
In docs/TROUBLESHOOTING.md around lines 367 to 370, the Ollama install command
uses an outdated domain; update the URL from https://ollama.ai/install.sh to the
current official https://ollama.com/install.sh so the curl install line points
to the correct official installer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Docs] Common errors and solutions guide

2 participants