[BUG] AttributeError: 'int' object has no attribute 'get' in crew_run_tui.py during plan rendering
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 58.8k
- Forks
- 8.5k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 109
Description
Description
When running a CrewAI project using a local LLM via Ollama (qwen2.5-coder:7b), the CrewAI CLI TUI crashes during the planning phase. The crash occurs while rendering the main content of the plan steps in crew_run_tui.py.
It seems the TUI expects step to be a dictionary with keys like step_number and description, but instead receives an int or a malformed object from the local LLM's structured planning output, causing an AttributeError.
Steps to Reproduce
- Create a CrewAI project using the new JSON-first architecture (
crew.jsonc,agents/, etc.). - Configure a local model via Ollama (e.g.,
qwen2.5-coder-7b-q4_k_m.gguf). - Set up a multi-agent task that requires planning.
- Run
crewai run. - Wait for the model to generate the plan steps. The TUI crashes immediately when trying to render the plan.
Expected behavior
The CrewAI TUI should safely handle any unstructured or malformed step objects returned by local LLMs without crashing the entire runtime application. It should either fall back to raw text rendering or display a placeholder.
Screenshots/Code snippets
The issue happens in crew_run_tui.py inside the loop that renders steps:
for step in self._plan["steps"]:
sn = step.get("step_number", 0) # <--- Crashes here because 'step' is an int, not a dict
Operating System
macOS (Mac mini M4)
Python Version
3.12
╭─────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────╮
│ /Users/aaa/.local/share/uv/tools/crewai/lib/python3.12/site-packages/crewai_cli/crew_run_tui.py:1198 in _tick │
│ │
│ 1195 │ │ │ with self._lock: │
│ 1196 │ │ │ │ self._render_sidebar() │
│ 1197 │ │ │ │ self._render_task_header() │
│ ❱ 1198 │ │ │ │ self._render_main_content() │
│ 1199 │ │ │ │ if self.query_one("#log-panel").display: │
│ 1200 │ │ │ │ │ self._render_log_panel() │
│ 1201 │ │ except NoMatches: │
│ │
│ ╭─────────────────────────────────────────────────── locals ───────────────────────────────────────────────────╮ │
│ │ elapsed = 179.00139904022217 │ │
│ │ mins = 2 │ │
│ │ secs = 59 │ │
│ │ self = CrewRunApp(title='CrewAI — test', classes={'-dark-mode'}, pseudo_classes={'focus', 'dark'}) │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /Users/aaa/.local/share/uv/tools/crewai/lib/python3.12/site-packages/crewai_cli/crew_run_tui.py:1499 in _render_main_content │
│ │
│ 1496 │ │ │ │ t.append("\n") │
│ 1497 │ │ │ │ │
│ 1498 │ │ │ │ for step in self._plan["steps"]: │
│ ❱ 1499 │ │ │ │ │ sn = step.get("step_number", 0) │
│ 1500 │ │ │ │ │ desc = step.get("description", "") │
│ 1501 │ │ │ │ │ short = desc[:90] │
│ 1502 │ │ │ │ │ if len(desc) > 90: │
│ │
│ ╭─────────────────────────────────────────────────────────── locals ───────────────────────────────────────────────────────────╮ │
│ │ completed = False │ │
│ │ plan_title = 'Analyze requirements, create directory, list files, read file contents, write pr'+265 │ │
│ │ self = CrewRunApp(title='CrewAI — test', classes={'-dark-mode'}, pseudo_classes={'focus', 'dark'}) │ │
│ │ should_scroll = False │ │
│ │ step = 1 │ │
│ │ t = <text ' PLAN\n ▸ Analyze requirements, create directory, list files, read file contents, write pr\n\n' │ │
│ │ [Span(0, 7, 'bold #666666'), Span(7, 11, 'bold #1F7982'), Span(11, 92, 'bold #1F7982')] ''> │ │
│ │ widget = Static(id='main-content') │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'int' object has no attribute 'get'
[CrewAIEventsBus] Warning: Ending event 'memory_save_failed' emitted with empty scope stack. Missing starting event?
Operating System
macOS Catalina
Python Version
3.12
crewAI Version
1.15.21
crewAI Tools Version
1.15.21
Virtual Environment
Venv
Evidence
/Users/alp/.local/share/uv/tools/crewai/lib/python3.12/site-packages/crewai_cli/crew_run_tui.py:1198 in _tick
1195 │ │ │ with self._lock:
1196 │ │ │ │ self._render_sidebar()
1197 │ │ │ │ self._render_task_header()
11 ❱ 1198 │ │ │ │ self._render_main_content()
1199 │ │ │ │ if self.query_one("#log-panel").display:
1200 │ │ │ │ │ self._render_log_panel()
1201 │ │ except NoMatches:
/Users/alp/.local/share/uv/tools/crewai/lib/python3.12/site-packages/crewai_cli/crew_run_tui.py:1499 in _render_main_content
1496 │ │ │ │ t.append("\n")
1497 │ │ │ │
1498 │ │ │ │ for step in self._plan["steps"]:
12 ❱ 1499 │ │ │ │ │ sn = step.get("step_number", 0)
1500 │ │ │ │ │ desc = step.get("description", "")
1501 │ │ │ │ │ short = desc[:90]
1502 │ │ │ │ │ if len(desc) > 90:
AttributeError: 'int' object has no attribute 'get'
[CrewAIEventsBus] Warning: Ending event 'memory_save_failed' emitted with empty scope stack. Missing starting event?
Possible Solution
Add a type check inside _render_main_content before calling .get() on the step object:
for step in self._plan["steps"]:
if not isinstance(step, dict):
# Handle non-dict steps gracefully (e.g., skip or convert to string)
continue
sn = step.get("step_number", 0)
Additional context
Using a local Ollama setup with Qwen 2.5 Coder 7B (Q4_K_M). The issue doesn't seem to happen with OpenAI, likely because OpenAI perfectly adheres to the required structured output schema for planning, while smaller local models can occasionally emit arrays of numbers or text instead of dictionaries for steps.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in crew_run_tui.py at _render_main_content and inspect how self._plan["steps"] is rendered. Reproduce with crewai run using the reported Ollama setup and malformed planning output. Done means non-dictionary steps no longer crash the TUI and are safely skipped, displayed as raw text, or represented by a placeholder.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ollama, python
- Domain
- ai, cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100