ISSUE DESCRIPTION jarvis agents list Traceback Description Learning OpenJarvis on a…
- User
ISSUE DESCRIPTION
jarvis agents list Traceback
Description
Learning OpenJarvis on a Windows machine with WSL2. I was wondering what would happen on a clean reboot and listed the agents. This worked the first two times and listed the "... My Assistant │ deep_research ...". I even used the ID to ask it questions which worked (jarvis agents ask b0e6dece007b "How can I contribute to the OpenJarvis Project"). I had not loaded the model (Gemma 4 31b) into Ollama (this was direct from an open WSL Ubuntu window). My alias for jarvis is jarvis() { cd "@" }
My config is terse # OpenJarvis configuration # Hardware: 13th Gen Intel(R) Core(TM) i9-13900K (32 cores, 62.6 GB RAM) # GPU: NVIDIA GeForce RTX 4090 (24.0 GB VRAM) # Full reference config: jarvis init --full
[engine] default = "ollama"
[engine.ollama] # host = "http://localhost:11434" # set to remote URL if engine runs elsewhere
[intelligence] default_model = "gemma4:31b"
[agent] default_agent = "simple"
[tools] enabled = ["code_interpreter", "web_search", "file_read", "shell_exec"]
Steps to Reproduce
- Start an initial WSL Ubuntu shell
- run "jarvis"
- this will list the --help command
- run "jarvis agents list"
- this will list a table with one agent b0e6dece007b │ My Assistant │ deep_research │ idle │ 0 │ 0
- run "jarvis agents ask b0e6dece007b "How are you""
- this will respond after it loads and starts the model, GPU memory is utilized
- run "ps -aux|grep ollama" in another shell window
- this will output two processes:
- ollama 196 0.0 0.3 3405152 220636 ? Ssl 11:29 0:01 /usr/local/bin/ollama serve
- ollama 1078 66.2 6.9 195616136 4544716 ? Sl 12:39 5:25 /usr/local/bin/ollama runner --ollama-engine --model usr/share/ollama/.ollama/models/blobs/sha256-280af6832eca23cb322c4dcc65edfea98a21b8f8ab07dc7553bd6f7e6e7a3313 --port 42291
- run "jarvis agents ask b0e6dece007b "How can I contribute to the OpenJarvis Project""
- This will respond
- Wait a bit, until GPU memory frees
- run the "ps -aux|grep ollama" in another shell window and see only the one ollam process for the "serve"
- run "jarvis agents list"
- see Traceback
Expected Behavior
Expected the table listing with one idle agent: b0e6dece007b │ My Assistant │ deep_research │ idle │ 0 │ 0
Actual Behavior
Traceback
Operating System
Linux
Python Version
3.12
Hardware
NVIDIA GPU
Engine
Ollama
Logs / Traceback
Traceback (most recent call last): File "/home/gru/projects/OpenJarvis/.venv/bin/jarvis", line 10, in <module> sys.exit(main()) ^^^^^^ File "/home/gru/projects/OpenJarvis/src/openjarvis/cli/__init__.py", line 122, in main cli() File "/home/gru/projects/OpenJarvis/.venv/lib/python3.12/site-packages/click/core.py", line 1485, in __call__ return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/gru/projects/OpenJarvis/.venv/lib/python3.12/site-packages/click/core.py", line 1406, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/home/gru/projects/OpenJarvis/.venv/lib/python3.12/site-packages/click/core.py", line 1873, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/gru/projects/OpenJarvis/.venv/lib/python3.12/site-packages/click/core.py", line 1873, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/gru/projects/OpenJarvis/.venv/lib/python3.12/site-packages/click/core.py", line 1269, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/gru/projects/OpenJarvis/.venv/lib/python3.12/site-packages/click/core.py", line 824, in invoke return callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/gru/projects/OpenJarvis/src/openjarvis/cli/agent_cmd.py", line 91, in list_agents console.print(f"[red]Error: {exc}[/red]") File "/home/gru/projects/OpenJarvis/.venv/lib/python3.12/site-packages/rich/console.py", line 1698, in print renderables = self._collect_renderables( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/gru/projects/OpenJarvis/.venv/lib/python3.12/site-packages/rich/console.py", line 1558, in _collect_renderables self.render_str( File "/home/gru/projects/OpenJarvis/.venv/lib/python3.12/site-packages/rich/console.py", line 1448, in render_str rich_text = render_markup( ^^^^^^^^^^^^^^ File "/home/gru/projects/OpenJarvis/.venv/lib/python3.12/site-packages/rich/markup.py", line 167, in render raise MarkupError( rich.errors.MarkupError: closing tag '[/red]' at position 65 doesn't match any open tagADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /OpenJarvis, current file: none) bash-$
Assistant
Let me analyze the issue. The error is a
rich.errors.MarkupErrorthat occurs when runningjarvis agents list. The error message says:rich.errors.MarkupError: closing tag '[/red]' at position 65 doesn't match any open tagThis happens in
/home/gru/projects/OpenJarvis/src/openjarvis/cli/agent_cmd.py, line 91:console.print(f"[red]Error: {exc}[/red]")The issue is that the
{exc}variable contains a string that has Rich markup characters (like[or]) that interfere with Rich's markup parsing. When the error message from the exception contains square brackets, Rich tries to interpret them as markup tags, causing the mismatch.Let me explore the repository structure and find the relevant file to fix this issue.
Assistant
Let me find the agent_cmd.py file that's mentioned in the traceback.
Assistant
Now I can see the issue. On line 91, the code has:
console.print(f"[red]Error: {exc}[/red]")The problem is that when
{exc}contains text with square brackets (like Ollama connection error messages often do), Rich's markup parser interprets those brackets as markup tags. For example, if the error message is something like[Errno 111] Connection refused, Rich will try to parse[Errno 111]as a markup tag, causing the mismatch with the closing[/red]tag.The fix is to escape the exception message before embedding it in Rich markup. In Rich, you can do this by either:
- Using
[dim]{exc}[/dim]with escaping - Using
console.print(f"[red]Error:[/red] {exc}")- putting the variable outside the markup tags - Using
rich.markup.escape()to escape the variable
Let me check if there are similar issues elsewhere in the file and also look for how Rich handles escaping.
- Using
Assistant
There are 11 occurrences of this pattern. The simplest fix is to move the
{exc}outside the markup tags so Rich won't try to parse the exception message as markup. Let me apply the fix to all occurrences.Assistant
Let me verify the changes were applied correctly:
Assistant
All 11 occurrences have been fixed. Now let me verify the fix by creating a simple test script that reproduces the issue:
Assistant
The fix works. The error messages with square brackets are now displayed correctly without causing the
MarkupError.Now let me also verify that the old pattern would have failed with bracket-containing errors:
Assistant
Interesting - it seems like this version of Rich might not throw an error for this specific case. Let me check the exact error scenario more carefully. The traceback shows position 65, and the error was about
[/red]not matching an open tag. Let me try different error message variations:Assistant
Now I see it. When the exception message contains
[/red], it causes the markup error. This could happen if an error message references Rich formatting or contains certain strings. The fix I applied is still the correct approach since it prevents any potential markup issues with arbitrary error messages.Let me also check if there are any tests in the repository that I should run:
Assistant
Let me check if there are any tests related to the CLI agent commands:
Assistant
Let me run the existing test for the agent_cmd module:
Assistant
All 17 tests pass. Let me verify the diff of my changes:
Assistant
I've successfully resolved the issue. Here's a summary of what I did:
Problem: The
jarvis agents listcommand was throwing arich.errors.MarkupErrorbecause exception messages containing square brackets (like[/red]) were being interpreted as Rich markup tags, causing a tag mismatch error.Fix: Changed all 11 occurrences of
console.print(f"[red]Error: {exc}[/red]")toconsole.print(f"[red]Error:[/red] {exc}")insrc/openjarvis/cli/agent_cmd.py. This moves the exception message outside the Rich markup tags so its contents won't be parsed as markup.Verification:
- Confirmed the old pattern fails when exception messages contain
[/red]tags - Confirmed the new pattern works correctly with all types of error messages
- All 17 existing tests in
tests/cli/test_agent_cmd.pypass
Checklist:
- ✅ Error reproduced: Created a test script confirming that exception messages with
[/red]cause theMarkupErrorwith the old pattern - ✅ Fix confirmed: Created a test script confirming the new pattern works correctly with bracket-containing error messages
- ✅ Edge cases handled: The fix handles all edge cases (square brackets, Rich-like tags, special characters) by keeping variable content outside markup tags
- ✅ Existing tests pass: All 17 tests in
tests/cli/test_agent_cmd.pypass
- Confirmed the old pattern fails when exception messages contain
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →