Skip to content

Conversation

@MChandrahas
Copy link

@MChandrahas MChandrahas commented Dec 12, 2025

Related Issue

Closes #263

Summary

This PR adds a comprehensive troubleshooting guide (docs/TROUBLESHOOTING.md).

It supersedes PR #280 by addressing the following review feedback:

  • Security: Replaced unsafe sudo echo >> redirection with sudo tee.
  • Modernization: Replaced deprecated ntpdate with timedatectl.
  • Accuracy: Removed non-existent CORTEX_MODEL environment variables.
  • Updates: Updated Ollama installation URL to the current official domain.

Checklist

  • Tests pass (Documentation only)
  • PR title format: [#263] docs: Add Comprehensive Troubleshooting Guide
  • MVP label added if closing MVP issue

Summary by CodeRabbit

  • Documentation
    • Added a comprehensive Troubleshooting Guide for Cortex Linux covering API key issues, installation errors, network/connectivity problems, permission errors, LLM provider configuration, package manager conflicts, performance tuning, and rollback/recovery. Sections include symptoms, step-by-step remediation, and practical examples to diagnose and resolve common operational problems.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 12, 2025

Walkthrough

Adds a new documentation file docs/TROUBLESHOOTING.md that provides a comprehensive troubleshooting guide for Cortex Linux. The guide is organized into eight categories (API keys, installation, networking, permissions, LLM providers, package managers, performance, rollback & recovery) with symptoms and step-by-step remediation commands.

Changes

Cohort / File(s) Summary
Troubleshooting Documentation
docs/TROUBLESHOOTING.md
New troubleshooting guide containing a Table of Contents and eight sections: API Key Issues, Installation Errors, Network & Connectivity, Permission Problems, LLM Provider Issues, Package Manager Conflicts, Performance Issues, and Rollback & Recovery. Each section includes example symptoms and structured remediation steps with copy-paste commands and workflows (env vars, wizard usage, system checks, recovery commands).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

  • Verify command correctness and terminal quoting/escaping.
  • Confirm coverage vs. linked issue acceptance criteria (top error scenarios, plain-English explanations, copy-paste fixes).
  • Check formatting consistency with repository docs (headings, code blocks, TOC links).

Poem

🐰 I hopped through logs both day and night,
Found missing keys and networking blight,
I left commands, clear and bright,
To guide you back to working light —
A tiny rabbit's troubleshooting delight.

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding a troubleshooting guide documentation.
Description check ✅ Passed The description includes all required sections: Related Issue, Summary, and Checklist. It provides context about improvements made over the superseded PR.
Linked Issues check ✅ Passed The PR addresses all core coding requirements from issue #263: creates docs/TROUBLESHOOTING.md covering API errors, system errors, and network errors with causes and fixes as specified.
Out of Scope Changes check ✅ Passed All changes are scoped to the troubleshooting guide documentation file. No unrelated modifications detected beyond the stated objective.
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

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 114508e and d266c93.

📒 Files selected for processing (1)
  • docs/TROUBLESHOOTING.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/TROUBLESHOOTING.md

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.

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: 8

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5a1755c and 114508e.

📒 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)


73-73: Horizontal rule style
Expected: ---; Actual: -----

(MD035, hr-style)


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

(MD040, fenced-code-language)


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

(MD040, fenced-code-language)


128-128: Horizontal rule style
Expected: ---; Actual: -----

(MD035, hr-style)


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

(MD040, fenced-code-language)


166-166: Horizontal rule style
Expected: ---; Actual: -----

(MD035, hr-style)


184-184: Horizontal rule style
Expected: ---; Actual: -----

(MD035, hr-style)


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

(MD040, fenced-code-language)


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

(MD040, fenced-code-language)


224-224: Horizontal rule style
Expected: ---; Actual: -----

(MD035, hr-style)


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

(MD040, fenced-code-language)


241-241: Horizontal rule style
Expected: ---; Actual: -----

(MD035, hr-style)


258-258: Horizontal rule style
Expected: ---; Actual: -----

(MD035, hr-style)

Comment on lines 1 to 283
# Troubleshooting Guide

Common errors and solutions for Cortex Linux.

## Table of Contents

- [API Key Issues](#api-key-issues)
- [Installation Errors](#installation-errors)
- [Network & Connectivity](#network--connectivity)
- [Permission Problems](#permission-problems)
- [LLM Provider Issues](#llm-provider-issues)
- [Package Manager Conflicts](#package-manager-conflicts)
- [Performance Issues](#performance-issues)
- [Rollback & Recovery](#rollback--recovery)

---

## API Key Issues

### Error: "No API key found"

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

**Solutions:**

1. **Set the environment variable:**
```bash
# For Claude (recommended)
export ANTHROPIC_API_KEY='sk-ant-api03-your-key-here'

# For OpenAI
export OPENAI_API_KEY='sk-your-key-here'
```

2. **Add to shell config for persistence:**
```bash
echo 'export ANTHROPIC_API_KEY="sk-ant-api03-your-key"' >> ~/.bashrc
source ~/.bashrc
```

3. **Use the setup wizard:**
```bash
cortex wizard
```

4. **For offline mode (no API key needed):**
```bash
export CORTEX_PROVIDER=ollama
cortex install docker
```

### Error: "API rate limit exceeded"

**Symptom:**
```
Error: Rate limit exceeded. Please wait before trying again.
```

**Solutions:**
1. **Wait and retry:**
```bash
sleep 60 && cortex install docker
```

2. **Use a different provider temporarily:**
```bash
export CORTEX_PROVIDER=ollama
```

-----

## Installation Errors

### Error: "Package not found"

**Symptom:**
```
E: Unable to locate package xyz
```

**Solutions:**

1. **Update package lists:**
```bash
sudo apt update
```

2. **Use natural language for better matching:**
```bash
cortex install "text editor like vim" # Instead of exact package name
```

### Error: "Dependency problems"

**Solutions:**

1. **Fix broken packages:**
```bash
sudo apt --fix-broken install
```

2. **Update and upgrade:**
```bash
sudo apt update && sudo apt upgrade
```

### Error: "dpkg lock"

**Symptom:**
```
E: Could not get lock /var/lib/dpkg/lock-frontend
```

**Solutions:**

1. **Check what's using it:**
```bash
sudo lsof /var/lib/dpkg/lock-frontend
```

2. **Kill stuck apt process (use with caution):**
```bash
sudo killall apt apt-get
```
-----

## Network & Connectivity

### Error: "Could not resolve host"

**Symptom:**
```
Could not resolve 'archive.ubuntu.com'
```

**Solutions:**

1. **Check internet connection:**
```bash
ping -c 3 8.8.8.8
```

2. **Try different DNS (Safe Method):**
```bash
echo "nameserver 8.8.8.8" | sudo tee -a /etc/resolv.conf
```

### Error: "SSL certificate problem"

**Solutions:**

1. **Update CA certificates:**
```bash
sudo apt install ca-certificates
sudo update-ca-certificates
```

2. **Check system time (SSL requires correct time):**
```bash
timedatectl status
sudo timedatectl set-ntp true
```
-----

## Permission Problems

### Error: "Permission denied"

**Solutions:**

1. **Run with sudo for system packages:**
```bash
sudo cortex install docker --execute
```

2. **Check file ownership:**
```bash
ls -la ~/.cortex/
```

-----

## 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. **Install Ollama if missing:**
```bash
curl -fsSL https://ollama.com/install.sh | sh
```

### Error: "Context length exceeded"

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

**Solutions:**

1. **Simplify your request:**
Instead of asking for a "complete development environment," try installing tools individually (e.g., "python development tools").

2. **Change Provider:**
Switch to a provider that supports larger context windows (e.g., Anthropic) using the wizard:
```bash
cortex wizard
```
-----

## Package Manager Conflicts

### Error: "Snap vs apt conflict"

**Symptom:**
```
error: cannot install "firefox": classic confinement requires snaps
```

**Solutions:**

1. **Use snap with classic:**
```bash
sudo snap install firefox --classic
```
-----

## Performance Issues

### Slow AI responses

**Solutions:**

1. **Use local LLM:**
```bash
export CORTEX_PROVIDER=ollama
```

2. **Check network latency:**
```bash
ping api.anthropic.com
```
-----

## Rollback & Recovery

### How to undo an installation
```bash
# View installation history
cortex history

# Rollback last installation
cortex rollback

# Rollback specific installation
cortex rollback <installation-id>
```

### System recovery

If Cortex causes system issues:

1. **Boot into recovery mode**
2. **Use dpkg to fix:**
```bash
sudo dpkg --configure -a
sudo apt --fix-broken install
``` No newline at end of file
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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify whether any README already links to the troubleshooting guide
rg -n --hidden -S "TROUBLESHOOTING\.md|Troubleshooting Guide|Troubleshooting" -g'README*' -g'!.git/**'

Repository: cortexlinux/cortex

Length of output: 323


🏁 Script executed:

# Check the actual content around line 103 in README.md to see if it links to the troubleshooting guide
head -n 110 README.md | tail -n 20

Repository: cortexlinux/cortex

Length of output: 361


🏁 Script executed:

# Check if there's a more comprehensive link further down in README.md that points to the troubleshooting guide
rg -n "docs/TROUBLESHOOTING" README.md

Repository: cortexlinux/cortex

Length of output: 44


Link the new troubleshooting guide from README.md. The comprehensive docs/TROUBLESHOOTING.md is not referenced in the main README, making it undiscoverable. README.md has a brief "Troubleshooting" section but does not link to the full guide. Either add a link in this PR or explicitly document that a follow-up PR will handle it.

🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

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)


73-73: Horizontal rule style
Expected: ---; Actual: -----

(MD035, hr-style)


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

(MD040, fenced-code-language)


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

(MD040, fenced-code-language)


128-128: Horizontal rule style
Expected: ---; Actual: -----

(MD035, hr-style)


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

(MD040, fenced-code-language)


166-166: Horizontal rule style
Expected: ---; Actual: -----

(MD035, hr-style)


184-184: Horizontal rule style
Expected: ---; Actual: -----

(MD035, hr-style)


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

(MD040, fenced-code-language)


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

(MD040, fenced-code-language)


224-224: Horizontal rule style
Expected: ---; Actual: -----

(MD035, hr-style)


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

(MD040, fenced-code-language)


241-241: Horizontal rule style
Expected: ---; Actual: -----

(MD035, hr-style)


258-258: Horizontal rule style
Expected: ---; Actual: -----

(MD035, hr-style)

@sonarqubecloud
Copy link

@MChandrahas
Copy link
Author

@mikejmorgan-ai Once you review and approve the new commit, we can link the new troubleshooting guide from README.md as suggested by the coderabbitai bot. Thanks.

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

1 participant