Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Check task_outputs length to prevent Out-of-Index error #2013

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/crewai/crew.py
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,8 @@ def _handle_conditional_task(
task_outputs = self._process_async_tasks(futures, was_replayed)
futures.clear()

previous_output = task_outputs[task_index - 1] if task_outputs else None
prev_output_index = task_index - 1 if len(task_outputs) > 1 else 0
previous_output = task_outputs[prev_output_index] if task_outputs else None
if previous_output is not None and not task.should_execute(previous_output):
self._logger.log(
"debug",
Expand Down