Victor Troubleshooting Guide¶
This guide helps you diagnose and fix common issues with Victor. For interactive diagnostics, use victor doctor.
Quick Reference¶
| Command | Purpose |
|---|---|
victor doctor |
Run comprehensive diagnostics |
victor config validate |
Validate configuration |
victor profile list |
List available profiles |
victor profile current |
Show current profile |
Installation Issues¶
Python Version Errors¶
Problem: ModuleNotFoundError: No module named 'victor'
Symptoms:
- Import errors when running victor commands
- Package not found after installation
Diagnosis:
Solutions:
1. Verify Python version (requires 3.12+):
-
Reinstall Victor:
-
Use pip with explicit Python:
Prevention:
- Always use Python 3.12 or higher
- Use virtual environments: python -m venv .venv
Dependency Installation Errors¶
Problem: ERROR: Could not build wheels for...
Symptoms:
- Installation fails during dependency build
- Missing system dependencies
Diagnosis:
Solutions:
1. Install system dependencies (macOS):
-
Install system dependencies (Ubuntu/Debian):
-
Install system dependencies (Fedora/RHEL):
Prevention:
- Use pre-built wheels when available
- Keep system packages updated
Configuration Issues¶
API Key Not Found¶
Problem: Error: API key not found for provider
Symptoms:
- Provider authentication failures
- "Unauthorized" or "401" errors
Diagnosis:
Solutions:
1. Set API key (Anthropic):
-
Set API key (OpenAI):
-
Add to
~/.bashrcor~/.zshrc:
-
Configure in profile YAML (
~/.victor/profiles.yaml):
Prevention:
- Use victor init --wizard for guided setup
- Run victor doctor to verify configuration
Provider Not Available¶
Problem: Provider 'xyz' is not available
Symptoms:
- Provider not recognized
- Import errors for provider module
Diagnosis:
Solutions:
1. Use a supported provider:
# Available: anthropic, openai, google, ollama, lmstudio, vllm, etc.
victor chat --provider anthropic
- Install additional dependencies if needed:
Prevention:
- Check provider compatibility before setup
- Use victor providers list to see available providers
Invalid Configuration¶
Problem: Configuration validation failed
Symptoms:
- Settings errors at startup
- YAML parsing errors
Diagnosis:
# Validate configuration
victor config validate --verbose
# Check YAML syntax
python -c "from pathlib import Path; import yaml; yaml.safe_load(Path('~/.victor/profiles.yaml').expanduser().read_text())"
Solutions:
1. Fix YAML syntax errors:
# Correct:
profiles:
default:
provider: ollama
# Incorrect (missing colon):
profiles
default
provider ollama
-
Validate with
victor config validate:
-
Use profile presets for quick setup:
Prevention:
- Use YAML linters in your editor
- Run victor config validate after changes
- Use configuration profiles as starting points
Runtime Issues¶
Ollama Connection Failed¶
Problem: Failed to connect to Ollama
Symptoms:
- "Ollama is not running" errors
- Connection refused
Diagnosis:
Solutions:
1. Start Ollama:
# macOS/Linux
ollama serve
# Or use service (macOS)
brew services start ollama
# Or use systemd (Linux)
systemctl start ollama
-
Install Ollama if missing:
-
Verify connection:
Prevention:
- Start Ollama on system boot (brew services, systemd)
- Use victor doctor to verify Ollama status
Timeout Errors¶
Problem: Request timeout after N seconds
Symptoms:
- Requests timing out
- Slow responses from provider
Diagnosis:
# Check timeout settings
victor profile current
# Test provider connectivity
victor providers check <provider> --connectivity
Solutions:
1. Increase timeout in profile:
-
Check network connectivity:
-
Use local provider for faster responses:
Prevention:
- Use appropriate timeouts for your network
- Consider local providers for faster responses
- Enable HTTP connection pooling
Rate Limiting¶
Problem: Rate limit exceeded or 429 errors
Symptoms:
- Request throttling
- "Too many requests" errors
Diagnosis:
Solutions:
1. Wait and retry:
-
Use different provider:
-
Reduce request frequency:
- Fewer concurrent requests
- Larger batch sizes instead of multiple small requests
Prevention:
- Monitor usage limits
- Use appropriate tier for your workload
- Implement caching to reduce API calls
Performance Issues¶
Slow First Response¶
Problem: First request takes very long
Symptoms:
- 10+ second delays on first message
- Slow startup
Diagnosis:
Solutions:
1. Enable framework preloading:
-
Enable tool selection cache:
-
Use advanced or expert profile:
Expected Improvements:
- Preloading: 50-70% faster first requests
- Tool cache: 20-40% faster conversations
- HTTP pooling: 20-30% faster HTTP requests
Slow Subsequent Responses¶
Problem: Responses are slow even after initial setup
Symptoms:
- Consistent delays on each message
- Poor performance throughout
Diagnosis:
# Check cache settings
victor profile current
# View performance metrics
victor observability metrics cache
Solutions:
1. Verify caching is enabled:
-
Use smaller/faster models:
-
Check provider performance:
- Cloud providers may have latency
- Local providers (Ollama) depend on hardware
Prevention:
- Use appropriate model size for your hardware
- Enable all performance optimizations
- Monitor with victor observability metrics
High Memory Usage¶
Problem: Victor using too much memory
Symptoms:
- System becomes slow
- Out of memory errors
Diagnosis:
Solutions:
1. Reduce context window:
-
Clear cache periodically:
-
Use lighter models:
- 7B models instead of 30B+
- Quantized models when available
Prevention:
- Monitor memory usage with victor observability
- Set appropriate max_tokens for your hardware
- Regular cache maintenance
Tool Execution Issues¶
Docker Errors¶
Problem: Docker not running or Docker not installed
Symptoms:
- Code execution fails
- Container creation errors
Diagnosis:
Solutions:
1. Start Docker Desktop:
- Launch Docker Desktop application
- Wait for "Docker is running" status
-
Start Docker daemon:
-
Install Docker if missing:
-
Verify permissions:
Prevention:
- Start Docker on system boot
- Ensure proper user permissions
- Run victor doctor to check Docker status
File Permission Errors¶
Problem: Permission denied when reading/writing files
Symptoms:
- Cannot read project files
- Cannot write changes
Diagnosis:
Solutions:
1. Fix file permissions:
-
Fix directory permissions:
-
Run Victor with appropriate permissions:
Prevention:
- Ensure project files are readable
- Run victor doctor to check permissions
- Avoid running as root unless necessary
Git Operation Errors¶
Problem: Git operations fail with errors
Symptoms:
- Cannot commit changes
- Push/pull failures
Diagnosis:
Solutions:
1. Configure git identity:
-
Fix force push protection:
-
Resolve merge conflicts:
Prevention:
- Never use git push --force to main/master
- Run victor doctor to check git configuration
- Use feature branches instead of main
Error Messages Reference¶
Common Error Codes¶
| Error Code | Description | Solution |
|---|---|---|
NO_API_KEY |
No API key configured | Set ANTHROPIC_API_KEY or OPENAI_API_KEY |
PROVIDER_CONNECTION_FAILED |
Cannot connect to provider | Check provider status, network connectivity |
CONFIGURATION_INVALID |
Configuration has errors | Run victor config validate |
TOOL_EXECUTION_FAILED |
Tool execution failed | Check Docker, file permissions |
TIMEOUT |
Request timeout | Increase timeout, check network |
Provider-Specific Errors¶
Anthropic¶
- 401 Unauthorized: Invalid API key
- 429 Rate Limit: Too many requests
- 500 Internal Server Error: Anthropic service issue
OpenAI¶
- 401 Unauthorized: Invalid API key
- 429 Rate Limit: Quota exceeded
- 503 Service Unavailable: OpenAI service issue
Ollama¶
- Connection refused: Ollama not running
- Model not found: Model not downloaded
Getting Help¶
Diagnostic Commands¶
# Comprehensive diagnostics
victor doctor
# Configuration validation
victor config validate --verbose
# Test provider connectivity
victor providers check <provider> --connectivity
# View current profile
victor profile current
# List available profiles
victor profile list
Debug Mode¶
Enable verbose logging:
Where to Get Help¶
- Documentation: https://github.com/victor-ai/victor
- Issues: https://github.com/victor-ai/victor/issues
- Discussions: https://github.com/victor-ai/victor/discussions
- Doctor Command:
victor doctor --verbose
Reporting Issues¶
When reporting issues, include:
- Victor version:
victor --version - Python version:
python --version - OS and version
- Error message
- Steps to reproduce
- Doctor output:
victor doctor > doctor-output.txt
# Collect diagnostic information
victor --version > issue-info.txt
python --version >> issue-info.txt
victor doctor --verbose >> issue-info.txt
Quick Fix Checklist¶
When something doesn't work:
- Run diagnostics:
victor doctor - Validate configuration:
victor config validate - Check provider:
victor providers check <provider> --connectivity - Review profile:
victor profile current - Enable debug:
VICTOR_DEBUG=1 victor chat
Advanced Troubleshooting¶
Enable Verbose Logging¶
# In your Python code
import logging
logging.basicConfig(level=logging.DEBUG)
# Or via environment variable
import os
os.environ["VICTOR_DEBUG"] = "1"
Check Database Status¶
# View database location
victor doctor --verbose | grep database
# Check database integrity
python -c "from victor.core.database import get_database; print(get_database().db_path)"
Clear Cache¶
# Inspect cache usage
du -sh ~/.victor/cache 2>/dev/null || true
# Optional: clear cache files manually
rm -rf ~/.victor/cache/*
Reset Configuration¶
# Backup current configuration
cp ~/.victor/profiles.yaml ~/.victor/profiles.yaml.backup
# Apply default profile
victor profile apply basic
# Or manually edit
nano ~/.victor/profiles.yaml
Preventive Maintenance¶
Regular Tasks¶
Weekly:
- Run victor doctor
- Check for updates: pip install --upgrade victor-ai
Monthly:
- Review cache usage: du -sh ~/.victor/cache
- Review logs for errors
As Needed:
- Update dependencies
- Review and update profiles
- Clean up old sessions
Monitoring¶
# View performance metrics
victor observability metrics
# Check system resources
victor doctor --verbose | grep -E "memory|disk|cpu"
Provider Model Registration (Context-Window Mis-Resolution)¶
This runbook covers the class of failure where a new model (e.g. a newly
released flagship like glm-5.2) causes the UI to freeze, the agent to emit
empty responses, and the streaming executor to loop on "aggressive recovery"
—even though the model itself advertises a very large context window.
Problem¶
A provider profile advertises a model with a large context window (e.g. 1M
context), but once the conversation grows past a low threshold the session
freezes. Logs show a degenerate loop:
WARNING - chat_stream_helpers - Stream completed without content or tool calls
WARNING - chat_stream_helpers - Provider payload required tool-history repair: ... removed=1 ...
WARNING - chat_stream_executor - Model returned empty response - attempting aggressive recovery
Root Cause¶
The runtime does not read the advertised context window from
~/.victor/profiles.yaml (that loader only maps provider, model,
coding_plan, temperature, max_tokens, description). The effective window
comes from provider.context_window(model) (the BaseProvider API), consumed at
victor/agent/services/tool_service.py:2799 (_get_tool_context_window).
Two registration gaps cause the freeze:
- Missing
context_window()override. The base class method has its own
lookup table (victor/providers/base.py:1075) that does NOT include the new
model. Unknown models fall back to8192tokens
(base.py:1150warnsUnknown model ... using default context window of 8192). - Missing registry entry. If the provider only ships a custom
get_context_window()(note theget_prefix), it is not consulted by
the tool/KV-budgeting path — the basecontext_window()wins.
With the window mis-resolved to 8192:
- max_tool_tokens = int(8192 * 0.25) = 2048 for the tool schema budget
(tool_service.py:2740).
- KV session-locking is disabled (8192 >= 32000 is False,
tool_service.py:2810).
- Context pruning/compaction is tuned to a ceiling ~125x too small, so the
tool-history repair path starts removing messages — breaking the
OpenAI tool-call ↔ tool-result pairing and triggering the empty-response
recovery loop that manifests as the freeze.
Diagnosis¶
Confirm what the runtime actually sees (this is the authoritative check):
python -c "
from victor.providers.zai_provider import ZAIProvider
p = ZAIProvider(api_key='x')
for m in ['glm-5.2','glm-5.2:coding','glm-5.1','glm-4.6']:
print(f'{m:16} context_window()={p.context_window(m)}')
"
A healthy result shows the model's true window (e.g. 1000000). An unhealthy
result shows 8192 or a value far below the advertised window, plus the
Unknown model ... using default context window of 8192 warning.
Solutions¶
Preferred (config-driven, no code change):
- Register the model in
victor/config/provider_context_limits.yaml. This is
the single source of truth for context windows at runtime —
BaseProvider.context_window()consults it first, before any hardcoded
provider table. Add a fnmatch pattern undermodels:(takes precedence over
the provider default), or a provider block underproviders::
providers:
zai: # provider-level default for all GLM models
context_window: 200000
response_reserve: 8192
supports_extended_context: true
models:
"glm-5.2*": # model-specific override (highest precedence)
context_window: 1000000 # 753B MoE, 1M context
Resolution order at runtime:
1. models: fnmatch pattern (e.g. glm-5.2* matches glm-5.2 and
glm-5.2:coding)
2. providers: block default for the provider
3. the provider's hardcoded <PROVIDER>_MODELS table (legacy fallback)
4. 8192 safe default
- Re-run the diagnosis snippet above — both the exact name and any suffix
variant (e.g.glm-5.2:coding) must resolve to the true window.
Adding a new model is now a YAML edit. You only need to touch provider
code if the model also needs non-window metadata (max_output,
supports_thinking, etc.) for that provider'slist_models()/ capability
advertising. For context-window sizing alone, use the YAML.
Fallback (code edit, for providers without a YAML entry):
- Add an exact entry to the provider's
<PROVIDER>_MODELStable (e.g.
ZAI_MODELSinvictor/providers/zai_provider.py), placed so exact-match
wins, AND ensurecontext_window()(noget_prefix) is overridden to
delegate to it:
Note: adding
context_window:to~/.victor/profiles.yamlwill not fix
this — the profile loader ignores that field. Use
victor/config/provider_context_limits.yaml(the runtime override) instead.
Prevention (Adding Any New Model)¶
Follow this checklist whenever a new model is added (new release, new provider,
or new suffix/variant):
- Add a
models:pattern toprovider_context_limits.yamlwith the
correctcontext_window. This makes the window available to the runtime
budgeting path with no code change. - Confirm
context_window(model)resolves correctly by running the
diagnosis snippet — verify the exact name AND every suffix/variant used in
profiles (e.g.:coding,:china). - Check
get_provider_category()(victor/config/tool_tiers.py:184) —
tool-broadcasting strategy is tiered by window (<16384,<131072, ...);
a mis-resolved window picks the wrong strategy. - Watch the logs for the failure signature on first real use:
Unknown model ... using default context window of 8192, or the
tool-history repair ... removed=/attempting aggressive recoveryloop.
If either appears, the model is not registered for the budgeting path. - Add/extend the provider's unit test asserting
provider.context_window(model)returns the expected value for each
supported model name (seetest_context_window_config_driven_overridein
tests/unit/providers/test_zai_provider_ext.pyfor the config-driven
pattern).
Related Files¶
victor/config/provider_context_limits.yaml— runtime source of truth
for context windows (config-driven; edit this to register a new model)victor/config/config_loaders.py:166—get_provider_limits()YAML loader
(fnmatch patterns, TTL cache, hot-reload viainvalidate_config_cache())victor/providers/base.py:1055—context_window()consults the YAML first,
then falls back to its hardcoded table (8192 fallback at:1150)victor/providers/<provider>_provider.py— hardcoded<PROVIDER>_MODELS
registry (legacy fallback when no YAML entry exists)victor/agent/services/tool_service.py:2799,2740,2810— runtime consumersvictor/config/tool_tiers.py:184— provider category by window size
Related Documentation¶
- Configuration Guide: See
victor profile listfor available profiles - Provider Setup: See provider-specific documentation
- API Reference: See
docs/api/ - Architecture Guide: See
docs/architecture/directory