Summary
In garak/probes/base.py, Probe.probe() indexes prompts[0] without checking that the list is non-empty:
prompts = copy.deepcopy(self.prompts)
...
preparation_bar = tqdm.tqdm(total=len(prompts), ...) # len is fine with 0
if isinstance(prompts[0], str): # IndexError when empty
Repro
Observed on main (also flagged in PR #2022): tests/probes/test_probes.py::test_probe_prompt_translation[probes.sysprompt_extraction.SystemPromptExtraction] fails locally with IndexError: list index out of range at base.py:402 because the translated prompt set comes back empty under the local langprovider. len(prompts) is used for the progress bar two lines earlier, so the empty set reaches the subscript instead of producing zero attempts.
Expected behavior
A probe with an empty (or emptied-by-translation) prompt set should return no attempts — or raise a clear error naming the probe — rather than an IndexError deep in the execution path.
Suggested fix direction
if not prompts:
logging.warning("probe %s has an empty prompt set", self.probename)
return []
before the isinstance(prompts[0], str) check.
Happy to open a PR with a regression test.
Summary
In
garak/probes/base.py,Probe.probe()indexesprompts[0]without checking that the list is non-empty:Repro
Observed on
main(also flagged in PR #2022):tests/probes/test_probes.py::test_probe_prompt_translation[probes.sysprompt_extraction.SystemPromptExtraction]fails locally withIndexError: list index out of rangeatbase.py:402because the translated prompt set comes back empty under the local langprovider.len(prompts)is used for the progress bar two lines earlier, so the empty set reaches the subscript instead of producing zero attempts.Expected behavior
A probe with an empty (or emptied-by-translation) prompt set should return no attempts — or raise a clear error naming the probe — rather than an
IndexErrordeep in the execution path.Suggested fix direction
before the
isinstance(prompts[0], str)check.Happy to open a PR with a regression test.