20 Common Tasks & Troubleshooting
This chapter covers frequently asked questions and common problems.
Claude Code excels at debugging—paste an error message and it can usually trace the cause and suggest a fix.
I’m getting this error and don’t understand it: [paste error message]. This is the code that caused it: [paste code or filename:line]. What’s happening?
Claude will read the error, examine your code, and explain what went wrong in plain language. Include both the error and the code—context helps Claude trace the issue much faster.
Claude Code can help diagnose why previously working code suddenly breaks.
This script was working yesterday and now fails with: [error]. I didn’t change anything in the script. What could have changed?
Claude will investigate environment changes, package updates, or data differences that could explain the regression.
20.1 Conda
20.1.1 “command not found: conda”
macOS/Linux: Conda isn’t initialized in this shell session.
source ~/miniforge3/etc/profile.d/conda.sh
# Or for miniconda:
source ~/miniconda3/etc/profile.d/conda.shAdd this to your ~/.zshrc or ~/.bashrc to make it permanent.
Windows: Open “Anaconda Prompt” or “Miniforge Prompt” instead of regular Command Prompt.
20.1.2 “Solving environment” is very slow
Conda’s dependency resolver can be slow with complex environments.
Solutions:
Use mamba (faster drop-in replacement):
conda install mamba -n base mamba install package-nameCreate minimal environments:
conda create -n project python=3.11 pandas numpy # Instead of installing everything at onceUse conda-forge channel consistently:
conda config --add channels conda-forge conda config --set channel_priority strict
20.1.3 Environment not activating in Positron
- Open Positron’s integrated terminal
- Manually activate:
conda activate my-env - Use Command Palette: “Python: Select Interpreter” → choose the environment
20.1.4 Recreating a broken environment
conda deactivate
conda env remove -n broken-env
conda env create -f environment.yml20.2 renv
20.2.1 “The project is out-of-sync”
This warning means packages in your library don’t match renv.lock.
To see what’s different:
renv::status()To sync library to lockfile (recommended):
renv::restore()To update lockfile to match library:
renv::snapshot()20.2.2 Package installation fails
Try clearing the cache and rebuilding:
renv::install("package-name", rebuild = TRUE)For persistent issues:
# Check for system dependencies
renv::diagnostics()
# Install from a different repository
renv::install("package-name", repos = "https://cloud.r-project.org")20.2.3 Starting fresh with renv
renv::deactivate()rm -rf renv renv.lock .Rprofilerenv::init()20.3 Git
20.3.1 “Updates were rejected because the remote contains work…”
Someone pushed while you were working.
git pull
# Resolve any conflicts if needed
git push20.3.2 Accidentally committed large files
Remove from history (if not yet pushed):
git reset --soft HEAD~1
# Edit .gitignore to exclude the file
git add .gitignore
git commit -m "Fix gitignore"If already pushed, use BFG or git-filter-branch (more complex).
20.3.3 Undo the last commit (keep changes)
git reset --soft HEAD~120.3.4 See what changed in a file
git log -p filename.R20.3.5 Discard all uncommitted changes
git checkout -- .
# Or for all files including untracked:
git clean -fd⚠️ This permanently deletes uncommitted work!
20.4 Claude Code
20.4.1 “Command not found” for conda in Claude Code
Claude Code runs in a non-interactive shell. Always source conda first:
source ~/miniforge3/etc/profile.d/conda.sh && conda activate my-env && python script.pyDocument this pattern in your .claude/CLAUDE.md.
20.4.2 Claude doesn’t understand my project
Ensure .claude/CLAUDE.md exists and contains:
- Project overview
- Environment setup commands
- Key file locations
- Common workflows
20.4.3 Responses are generic or unhelpful
Provide more context:
- Show the specific file or code
- Explain what you’re trying to accomplish
- Share error messages in full
Instead of: “Fix the bug”
Try: “In analysis.R line 45, I get ‘object x not found’. Here’s the relevant code: [paste code]. The data is loaded from data/data.csv.”
20.5 Positron
20.5.1 R not detected
- Check R is installed:
R --versionin terminal - In Positron settings, search for “R Path” and set it explicitly
- Restart Positron
20.5.2 Python interpreter not showing
- Activate conda environment in terminal
- Command Palette → “Python: Select Interpreter”
- Click “Enter interpreter path” and navigate to the environment’s Python
20.5.3 Slow or unresponsive
- Close unused tabs
- Restart Positron
- Check if large objects are in memory (clear R/Python session)
- Check system memory usage
20.6 Quarto
20.6.1 “quarto: command not found”
macOS:
brew install quarto
# Or use full path:
/usr/local/bin/quarto render document.qmdWindows: Ensure Quarto installer added it to PATH. Restart terminal.
20.6.2 Render fails with R errors
- Run the R code chunks manually to find the error
- Check that all packages are installed
- Ensure working directory is correct (use
herepackage)
20.6.3 Render fails with Python errors
Ensure correct conda environment is active
Check Python interpreter in document YAML:
jupyter: python3
20.7 General Workflow
20.7.1 How do I start working on a project?
cd project-directory
conda activate project-env # if Python
positron .
# R activates renv automatically via .Rprofile20.7.2 How do I end a work session?
git status # See what changed
git add . # Stage changes
git commit -m "Description" # Commit
git push # Push to GitHub20.7.3 How do I update all packages?
Python:
conda update --all
conda env export > environment.yml
git add environment.yml && git commit -m "Update packages"R:
renv::update()
renv::snapshot()git add renv.lock && git commit -m "Update R packages"20.8 Getting Help
20.8.1 For tool-specific issues:
- Conda: docs.conda.io
- renv: rstudio.github.io/renv
- Git: git-scm.com/doc
- Positron: positron.posit.co
- Claude Code: claude.com/claude-code
- Quarto: quarto.org
20.8.2 In Claude Code:
Just ask! Describe your problem with as much detail as possible.