Skip to content

Resolve 'TypeError' in _setup_split_targets_build()#19

Open
9640-Akhil wants to merge 2 commits intoittiam-systems:masterfrom
9640-Akhil:no_targets_list
Open

Resolve 'TypeError' in _setup_split_targets_build()#19
9640-Akhil wants to merge 2 commits intoittiam-systems:masterfrom
9640-Akhil:no_targets_list

Conversation

@9640-Akhil
Copy link
Collaborator

@9640-Akhil 9640-Akhil commented Nov 18, 2025

This change addresses a TypeError in _setup_split_targets_build(). The error arises when _get_targets_list() returns None, because there is an attempt to check for fuzz_target in a NoneType object. To fix this, a separate check has been introduced to verify that targets_list is not None before it is iterated over.

@aditya-wazir
Copy link
Collaborator

Added a check to ensure 'targets_list' is not None before attempting to iterate over it.

This needs to be reworded. Add error reporting link. there is one format we were following for health related issue. refer that

@9640-Akhil
Copy link
Collaborator Author

Mark:

Hello Akhil Kumar, thank you for taking the time to address this issue. A few thoughts:

  1. This change indicates that the targets_list does not exist, which seems problematic. Do you have any insight as to why the list isn't being found?
  2. Why would this change resolve a TypeError?
  3. I noticed this is your first PR on the repo. We're happy to have your contributions. However, we always try to add test coverage when possible. Can you please add a testcase for this change in the below file?
    clusterfuzz/src/clusterfuzz/_internal/tests/core/build_management /build_manager_test.py

@9640-Akhil
Copy link
Collaborator Author

9640-Akhil commented Dec 1, 2025

Hello @\marktefftech, thank you for the feedback. I've addressed your points below.

  1. The _get_targets_list function returns None, when the targets.list file in the build's storage bucket is either missing or empty. As of today, we are seeing 3 jobs (libfuzzer_asan_android_host_nugget_os_emulator, libfuzzer_asan_android_host_sliderGSA, libfuzzer_asan_android_host_udfps) that are giving this error. When we checked theFUZZ_TARGET_BUILD_BUCKET_PATH for said jobs, the folder either ⁠doesn't exist or ⁠is empty.
  2. The TypeError occurs because the original code attempts to check for the presence of fuzz_target within targets_list even when targets_list is None . The change adds a preliminary check/condition for this case, the first part of the condition. If it is indeed found to be None, then there is no iteration over targets_list successfully avoiding the TypeError and raising a BuildNotFoundError inside the check instead.
  3. Thank you. I have added the testcase.

Added a check to ensure 'targets_list' is not None before attempting to iterate over it.
This change adds a test case for the fix in _setup_split_targets_build() to
handle cases where _get_targets_list() returns 'None'. The test ensures that
a 'BuildNotFoundError' is raised, instead of a 'TypeError'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants