Skip to content

[Phase 1] Backend: NoneType error accessing search_pattern during task execution #265

Description

@frankbria

Problem

Task execution fails with AttributeError: 'NoneType' object has no attribute 'search_pattern' when processing certain tasks during E2E tests.

Error

AttributeError: 'NoneType' object has no attribute 'search_pattern'

Followed by:

[WebServer] No files to review for task 868
[WebServer] Task 869 failed: AttributeError: 'NoneType' object has no attribute 'search_pattern'
[WebServer] No files to review for task 869
[WebServer] Task 871 failed: AttributeError: 'NoneType' object has no attribute 'search_pattern'

Root Cause

Code attempts to access .search_pattern attribute on an object that is None. This likely occurs when:

  1. A task's associated file pattern or search context is not initialized
  2. A database lookup returns None but the code doesn't check before accessing attributes
  3. Task metadata is incomplete from seeding

Affected Tasks

  • Task 868, 869, 871 (and potentially others)

Location

Likely in one of:

  • codeframe/agents/backend_worker_agent.py
  • codeframe/agents/frontend_worker_agent.py
  • codeframe/core/file_reviewer.py

Expected Behavior

When search_pattern or its parent object is None:

  1. Log a warning
  2. Skip the file review step gracefully
  3. Continue task execution or fail with a clear error message

Suggested Fix

# Before
files = self.find_files(task.search_pattern)

# After
if task.search_pattern is None:
    logger.warning(f"Task {task.id} has no search_pattern, skipping file review")
    files = []
else:
    files = self.find_files(task.search_pattern)

Or use defensive access:

search_pattern = getattr(task, 'search_pattern', None)
if search_pattern:
    files = self.find_files(search_pattern)

Impact

  • Multiple task execution failures
  • Tasks retry 3 times then marked as failed
  • Blocks agent execution workflow

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingphase-1Phase 1: CLI Foundation Completiontesting

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions