-
Notifications
You must be signed in to change notification settings - Fork 9
Troubleshooting
This guide covers common issues and their solutions when using bkmr.
Problem: bkmr: command not found after installation
Solutions:
- Cargo Install Path Not in PATH:
# Add to ~/.bashrc or ~/.zshrc
export PATH="$HOME/.cargo/bin:$PATH"
# Reload shell
source ~/.bashrc # or source ~/.zshrc
# Verify
which bkmr- pip/pipx Install Path:
# Check pip install location
pip show bkmr | grep Location
# Add to PATH if needed
export PATH="$HOME/.local/bin:$PATH"- Brew Install:
# Verify brew installation
brew list | grep bkmr
# Reinstall if needed
brew reinstall bkmr# Verify installation
bkmr --version
# Should show: bkmr x.x.xProblem: Error: Database not found at ~/.config/bkmr/bkmr.db
Solutions:
- Create Database:
# Create at default location
bkmr create-db ~/.config/bkmr/bkmr.db
# Or create at custom location
bkmr create-db ~/custom/path/bkmr.db
export BKMR_DB_URL=~/custom/path/bkmr.db- Check Environment Variable:
# Verify database path
echo $BKMR_DB_URL
# Set if not configured
export BKMR_DB_URL="$HOME/.config/bkmr/bkmr.db"
# Add to shell profile for persistence
echo 'export BKMR_DB_URL="$HOME/.config/bkmr/bkmr.db"' >> ~/.bashrc- Check File Permissions:
# Verify file exists and is readable
ls -la ~/.config/bkmr/bkmr.db
# Fix permissions if needed
chmod 644 ~/.config/bkmr/bkmr.dbProblem: Database file corrupted or damaged
Solution:
If you have backups:
# Check for automatic migration backups
ls -la ~/.config/bkmr/bkmr_backup_*.db
# Restore from backup
cp ~/.config/bkmr/bkmr_backup_20250412.db ~/.config/bkmr/bkmr.dbIf no backups exist:
# Create new database
bkmr create-db ~/.config/bkmr/bkmr_new.db
# Use new database
export BKMR_DB_URL=~/.config/bkmr/bkmr_new.db
# Re-import content if possibleProblem: Error: database is locked
Solutions:
- Close other bkmr instances:
# Check for running bkmr processes
ps aux | grep bkmr
# Kill if stuck
pkill bkmr- Check for stale locks:
# Remove SQLite lock files if they exist
rm -f ~/.config/bkmr/bkmr.db-shm
rm -f ~/.config/bkmr/bkmr.db-walProblem: Search returns no results when content exists
Troubleshooting:
- Check spelling:
# Try different spellings
bkmr search "docker"
bkmr search "dokcer" # typo
# Use wildcard
bkmr search "dock*"- Verify content exists:
# List all bookmarks
bkmr search ""
# Check specific tags
bkmr tags
bkmr search -t python- Test full-text search:
# Try different search patterns
bkmr search "python" # Simple term
bkmr search "python async" # Multiple terms
bkmr search "python OR rust" # Boolean
bkmr search "\"async await\"" # Exact phrase- Try fuzzy finder:
# Fuzzy finder is more forgiving
bkmr search --fzfProblem: Tag filters don't return expected results
Debugging:
- Verify tag exists:
# List all tags
bkmr tags
# Check if bookmark has expected tags
bkmr show <id>- Check tag filter syntax:
# Correct syntax
bkmr search -t python,async # AND (both tags required)
bkmr search -T python,rust # OR (any tag)
bkmr search -n deprecated # NOT (exclude tag)
# Common mistakes
bkmr search --tags python async # Wrong: space-separated
bkmr search -t python async # Wrong: 'async' treated as search term- System tags case-sensitive:
# Correct
bkmr search -t _snip_
# Wrong
bkmr search -t _Snip_
bkmr search -t SNIPProblem: bkmr search --fzf fails or doesn't show interface
Solutions:
- Install fzf:
# macOS
brew install fzf
# Linux (Debian/Ubuntu)
sudo apt install fzf
# Linux (Arch)
sudo pacman -S fzf
# Verify installation
which fzf
fzf --version- Test fzf directly:
# Test fzf works
echo -e "line1\nline2\nline3" | fzf- Check BKMR_FZF_OPTS:
# Verify environment variable
echo $BKMR_FZF_OPTS
# Test without custom options
unset BKMR_FZF_OPTS
bkmr search --fzf- Use skim alternative:
# bkmr uses skim internally, which is fzf-compatible
# If issues persist, check skim functionalityProblem: Content not behaving with expected action (copy, open, execute)
Debugging:
- Verify system tag:
# Check bookmark has correct system tag
bkmr show <id> | grep Tags
# Should include: _snip_, _shell_, _md_, _env_, or _imported_- Add missing system tag:
# Add system tag if missing
bkmr update -t _snip_ <id> # For snippets
bkmr update -t _shell_ <id> # For shell scripts
bkmr update -t _md_ <id> # For markdown
bkmr update -t _env_ <id> # For environment variables- Test action manually:
# Test open action
bkmr open <id>
# Enable debug logging
bkmr -d open <id>
bkmr -d -d open <id> # More verboseProblem: Content not copying to clipboard
Solutions:
macOS:
# Verify pbcopy works
echo "test" | pbcopy
pbpasteLinux (X11):
# Install xclip if missing
sudo apt install xclip # Debian/Ubuntu
sudo pacman -S xclip # Arch
# Test xclip
echo "test" | xclip -selection clipboard
xclip -o -selection clipboardLinux (Wayland):
# Verify Wayland clipboard support
echo $XDG_SESSION_TYPE # Should show "wayland"
# Install wl-clipboard if missing
sudo apt install wl-clipboard # Debian/Ubuntu
sudo pacman -S wl-clipboard # Arch
# Test wl-clipboard
echo "test" | wl-copy
wl-pasteCompatibility Check:
# bkmr automatically detects clipboard system
# Run with debug to see which system is used
bkmr -d yank <id>Problem: Shell scripts don't execute when opened
Debugging:
- Verify system tag:
# Check bookmark has _shell_ tag
bkmr show <id> | grep "_shell_"- Check interactive mode:
# Test direct execution
bkmr open --no-edit <id>
# Check configuration
echo $BKMR_SHELL_INTERACTIVE
# Disable interactive mode temporarily
BKMR_SHELL_INTERACTIVE=false bkmr open <id>- Test script directly:
# Extract script content
bkmr show <id>
# Copy content and test in shell manually- Check for errors:
# Enable debug logging
RUST_LOG=debug bkmr open <id>Problem: Expected interactive editing but script executes directly
Solutions:
- Check configuration:
# Verify interactive mode enabled
echo $BKMR_SHELL_INTERACTIVE # Should be "true" or unset
# In config.toml
cat ~/.config/bkmr/config.toml | grep -A 1 "shell_opts"
# Should show: interactive = true- Manually enable:
# Via environment variable
export BKMR_SHELL_INTERACTIVE=true
# Or in config.toml
[shell_opts]
interactive = trueProblem: Generated functions not available or not executing
Debugging:
- Verify stub generation:
# Test stub generation
bkmr search --shell-stubs
# Should output function definitions- Check if sourced:
# Verify functions are loaded
declare -F | grep backup
declare -F | grep deploy
# Re-source if needed
source <(bkmr search --shell-stubs)- Check for name conflicts:
# Check if function name conflicts with existing command
type backup-database
# If conflict, use namespacing
bkmr search --shell-stubs | sed 's/^/bkmr_/' > ~/.config/bkmr/functions.sh
source ~/.config/bkmr/functions.sh- Verify bookmark has shell tag:
# Only bookmarks with _shell_ tag generate stubs
bkmr search -t _shell_ --json | jq lengthProblem: Templates show raw syntax instead of resolved values
Debugging:
- Check where interpolation occurs:
# Search results: Requires --interpolate flag
bkmr search --interpolate "backup"
# FZF mode: Automatic
bkmr search --fzf "backup"
# Open action: Automatic
bkmr open <id>- Verify template syntax:
# Correct syntax
{{ current_date }}
{{ env("HOME") }}
{{ "hostname" | shell }}
# Check for typos
{{ current_date }} # Correct
{{ currentdate }} # Wrong
{{ current_date) }} # Wrong: mismatched braces- Test incrementally:
# Start simple
bkmr add "{{ current_date }}" test,_snip_ --title "Test"
# Test rendering
bkmr search --interpolate "Test"
bkmr open <id> # Should copy resolved date- Check logs:
# Enable debug logging
RUST_LOG=debug bkmr open <id> 2>&1 | grep -i templateProblem: {{ env("VAR") }} not resolving
Solutions:
- Verify variable exists:
# Check environment variable
echo $VARIABLE_NAME
# Set if missing
export VARIABLE_NAME="value"- Use fallback values:
# Always provide defaults
{{ env("API_KEY", "default-key") }}
{{ env("ENVIRONMENT", "development") }}- Check variable name:
# Correct
{{ env("HOME") }}
# Wrong
{{ env($HOME) }} # Don't use $
{{ env("home") }} # Case-sensitiveProblem: {{ "command" | shell }} returns empty or errors
Solutions:
- Test command directly:
# Verify command works
git branch --show-current
hostname- Check command in PATH:
# Verify command exists
which git
which hostname- Use full paths if needed:
# Relative path might fail
{{ "git" | shell }}
# Use full path
{{ "/usr/bin/git branch --show-current" | shell }}- Add error handling:
# Use fallbacks
{{ "git branch --show-current || echo 'no-git'" | shell }}Problem: Scripts with Go templates (GitHub CLI, Docker, Helm) fail
Solution - Use Dynamic Construction:
# Problem: This fails
gh run list --template '{{range .}}{{.name}}{{end}}'
# Solution: Construct template dynamically
OPEN_BRACE='{'
CLOSE_BRACE='}'
TEMPLATE="${OPEN_BRACE}${OPEN_BRACE}range .${CLOSE_BRACE}${CLOSE_BRACE}..."
gh run list --template "$TEMPLATE"Tools with Known Conflicts:
- GitHub CLI (
gh) - Docker Compose
- Helm charts
- Kubernetes manifests
- Terraform
See Template Interpolation for detailed solutions.
Problem: bkmr import-files fails with errors
Debugging:
- Check file exists:
# Verify file path
ls -la ~/scripts/backup.sh
# Check permissions
ls -la ~/scripts/- Verify frontmatter syntax:
# YAML frontmatter
---
name: "Script Name"
tags: ["tag1", "tag2"]
---
# Hash-style frontmatter
# name: Script Name
# tags: tag1, tag2- Test with dry-run:
# Preview what would be imported
bkmr import-files ~/scripts/ --dry-run
# Check for errors in output- Enable debug logging:
# See detailed import process
RUST_LOG=debug bkmr import-files ~/scripts/Problem: Error: Base path 'SCRIPTS_HOME' not found in configuration
Solution:
- Add to config.toml:
# Edit config
vim ~/.config/bkmr/config.toml
# Add base path section
[base_paths]
SCRIPTS_HOME = "$HOME/scripts"
DOCS_HOME = "$HOME/documents"- Verify configuration:
# Generate default config to see format
bkmr --generate-config | grep -A 5 "base_paths"
# Check current config
cat ~/.config/bkmr/config.toml | grep -A 5 "base_paths"Problem: bkmr edit <id> opens wrong file or fails to open source file
Debugging:
- Check if file-imported:
# Verify bookmark has file_path
bkmr show <id> | grep -i "file"- Verify source file exists:
# Check file path
bkmr show <id>
# Test if file exists (resolve base paths manually)
ls -la ~/scripts/backup.sh- Force database editing:
# Edit database content instead of source file
bkmr edit <id> --force-db- Check $EDITOR:
# Verify editor is configured
echo $EDITOR
# Set if missing
export EDITOR=vim # or nano, code, etc.Problem: LSP snippets not showing in editor
Debugging:
- Verify snippets exist:
# Check for snippets
bkmr search -t _snip_
# Check language-specific
bkmr search -t _snip_,rust- Test LSP server:
# Test basic connectivity
echo '{"jsonrpc":"2.0","method":"initialize","id":1,"params":{}}' | bkmr lsp
# Should return JSON with capabilities- Check bkmr version:
# LSP requires 4.31.0+
bkmr --version- Verify editor configuration:
# Neovim
:LspInfo # Check if bkmr_lsp attached
# VS Code
# Check Output → Language Server logsProblem: All snippets appear regardless of file type
Solutions:
- Tag snippets with language:
# Ensure language tags exist
bkmr update -t rust <id>
bkmr update -t python <id>- Verify file type detection:
# In Neovim
:set filetype?
# Should match language ID (python, rust, javascript)- Test language filtering:
# Use test scripts
python3 scripts/lsp/list_snippets.py --language rust --debugProblem: LSP server stops responding
Debugging:
- Enable debug logging:
# Start LSP with debug output
RUST_LOG=debug bkmr lsp 2>/tmp/bkmr-lsp.log
# Watch logs
tail -f /tmp/bkmr-lsp.log- Check for database issues:
# Verify database accessible
ls -la $BKMR_DB_URL
# Test database operations
bkmr search ""- Restart LSP server:
# Stop current instance
pkill -f "bkmr lsp"
# Restart from editor
# Neovim: :LspRestartProblem: Configuration file settings not applied
Debugging:
- Check file location:
# Default location
ls -la ~/.config/bkmr/config.toml
# Verify syntax
bkmr --generate-config > /tmp/test.toml
diff ~/.config/bkmr/config.toml /tmp/test.toml- Check TOML syntax:
# Common syntax errors
[fzf_opts]
height = "70%" # Correct: quoted string
height = 70% # Wrong: not quoted
[shell_opts]
interactive = true # Correct: boolean
interactive = "true" # Wrong: string (should be boolean)- Test with --config flag:
# Use explicit config file
bkmr --config ~/.config/bkmr/config.toml search "test"Problem: Environment variables not recognized
Solutions:
- Verify variables are exported:
# Check if set
echo $BKMR_DB_URL
echo $BKMR_FZF_OPTS
# Check if exported
export | grep BKMR- Add to shell profile:
# ~/.bashrc or ~/.zshrc
export BKMR_DB_URL="$HOME/.config/bkmr/bkmr.db"
export BKMR_SHELL_INTERACTIVE="true"
# Reload shell
source ~/.bashrc- Test precedence:
# Environment variables override config.toml
BKMR_DB_URL=/tmp/test.db bkmr search ""Sometimes you need to reset your database and recreate it with current data.
Process:
- Export existing data (if applicable):
# Export to JSON
bkmr search --json "" > backup.json
# Note: CSV export requires custom scripts- Create fresh database:
# Create new database
bkmr create-db ~/.config/bkmr/bkmr_new.db
# Switch to new database
mv ~/.config/bkmr/bkmr.db ~/.config/bkmr/bkmr_old.db
mv ~/.config/bkmr/bkmr_new.db ~/.config/bkmr/bkmr.db- Re-import content:
# Import files
bkmr import-files ~/scripts/ --base-path SCRIPTS_HOME
# Manually add critical bookmarks
# Or write script to parse backup.json and re-add- Recreate embeddings (if using semantic search):
# Mark bookmarks as embeddable
bkmr set-embeddable <id> --enable
# Backfill embeddings
bkmr --openai backfillAutomated Backups:
# Add to crontab for daily backups
backup-bkmr() {
local backup_dir="$HOME/backups/bkmr"
local date=$(date +%Y%m%d)
mkdir -p "$backup_dir"
cp ~/.config/bkmr/bkmr.db "$backup_dir/bkmr-$date.db"
# Keep only last 30 days
find "$backup_dir" -name "bkmr-*.db" -mtime +30 -delete
}
# Run daily at 2 AM
# Crontab: 0 2 * * * /path/to/backup-bkmrBasic debugging:
# Single debug flag
bkmr -d search "test"
# Double debug flag (more verbose)
bkmr -d -d search "test"
# Maximum verbosity with RUST_LOG
RUST_LOG=debug bkmr search "test"
RUST_LOG=trace bkmr search "test" # Very verboseRedirect debug output:
# Save to file for analysis
RUST_LOG=debug bkmr search "test" 2>/tmp/bkmr-debug.log
# View log
cat /tmp/bkmr-debug.logTest specific components:
# Search debugging
RUST_LOG=debug bkmr search "test" 2>&1 | grep -i "search"
# Action debugging
RUST_LOG=debug bkmr open <id> 2>&1 | grep -i "action"
# Template debugging
RUST_LOG=debug bkmr open <id> 2>&1 | grep -i "template"If you're still experiencing issues:
- Check version:
bkmr --version
# Ensure you're using latest version- Search existing issues:
- GitHub Issues: https://github.com/sysid/bkmr/issues
- Wiki: https://github.com/sysid/bkmr/wiki
- Create bug report with:
- bkmr version
- Operating system
- Steps to reproduce
- Debug logs (
RUST_LOG=debug) - Configuration files (sanitized)
- Community support:
- GitHub Discussions
- Issue tracker with
questionlabel
- Installation - Installation troubleshooting
- Configuration - Configuration details
- Basic Usage - Common usage patterns
- Search and Discovery - Search troubleshooting
- Shell Scripts - Shell execution issues
- Template Interpolation - Template issues
- Editor Integration - LSP troubleshooting