Probes: Rest Probes Error On Topic
Understanding the Issue
When running the garak
command with the --model_type rest
option and specifying the topic
probes, an error occurs. The error message indicates that no lexicon is found with the specified language and lexicon. However, when running the same code in a Python CLI, it executes successfully.
Error Message
The error message is as follows:
2025-05-22 14:40:27,606 INFO run started at 2025-05-22T14:40:27.132999
2025-05-22 14:40:27,606 DEBUG relative report dir provided
2025-05-22 14:40:27,607 INFO reporting to /Users/wgu002/.local/share/garak/garak_runs/garak.1208bf20-6a6a-436a-bbd4-1448f3c3f8ef.report.jsonl
2025-05-22 14:40:27,612 INFO harness init: <garak.harnesses.probewise.ProbewiseHarness object at 0x102ca12b0>
2025-05-22 14:40:27,612 INFO probe queue: probes.topic.WordnetControversial
2025-05-22 14:40:27,645 INFO probe init: <garak.probes.topic.WordnetControversial object at 0x10307a510>
2025-05-22 14:40:27,648 WARNING Exception instantiating garak.probes.topic.WordnetControversial: no lexicon found with lang=None and lexicon='oewn:2023'
Traceback (most recent call last):
File "/Users/wgu002/WORK/garak/.venv/lib/python3.13/site-packages/garak/_plugins.py", line 416, in load_plugin
plugin_instance = klass(config_root=config_root)
File "/Users/wgu002/WORK/garak/.venv/lib/python3.13/site-packages/garak/probes/topic.py", line 105, in __init__
self.w = wn.Wordnet(self.lexicon)
~~~~~~~~~~^^^^^^^^^^^^^^
File "/Users/wgu002/WORK/garak/.venv/lib/python3.13/site-packages/wn/_core.py", line 1116, in __init__
lexs = list(find_lexicons(lexicon or '*', lang=lang))
File "/Users/wgu002/WORK/garak/.venv/lib/python3.13/site-packages/wn/_queries.py", line 106, in find_lexicons
raise wn.Error(
f'no lexicon found with lang={lang!r} and lexicon={lexicon!r}'
)
wn.Error: no lexicon found with lang=None and lexicon='oewn:2023'
2025-05-22 14:40:27,658 WARNING failed to load probe GarakException(Error("no lexicon found with lang=None and lexicon='oewn:2023'")):
2025-05-22 14:40:27,658 INFO run complete, ending
2025-05-22 14:40:27,710 INFO garak run complete in 0.53s
Relevant Information
When running the same code in a Python CLI, it executes successfully:
>>> import wn
>>> wn.Wordnet('oewn:2023')
<wn.Wordnet object at 0x101df9960>
>>>
Possible Causes
The possible causes of this issue are:
- Lexicon Not Found: The error message indicates that no lexicon is found with the specified language and lexicon. This could be due to a missing or incorrect lexicon file.
- Language Not Supported: The
Wordnet
class may not support the specified language. - Configuration Issue: There may be a configuration issue with the
garak
command or thetopic
probes.
Troubleshooting Steps
To troubleshoot this issue, follow these steps:
- Check Lexicon File: Verify that the lexicon file exists and is correctly configured.
- Check Language Support: Check if the
Wordnet
class supports the specified language. - Check Configuration: Review the
garak
command andtopic
probes configuration to ensure that everything is correctly set up. - Run in Debug Mode: Run the
garak
command in debug mode to get more detailed error messages and stack traces.
Conclusion
Q: What is the cause of the error message "no lexicon found with lang=None and lexicon='oewn:2023'"?
A: The error message indicates that no lexicon is found with the specified language and lexicon. This could be due to a missing or incorrect lexicon file, or the Wordnet
class may not support the specified language.
Q: How do I troubleshoot the issue?
A: To troubleshoot this issue, follow these steps:
- Check Lexicon File: Verify that the lexicon file exists and is correctly configured.
- Check Language Support: Check if the
Wordnet
class supports the specified language. - Check Configuration: Review the
garak
command andtopic
probes configuration to ensure that everything is correctly set up. - Run in Debug Mode: Run the
garak
command in debug mode to get more detailed error messages and stack traces.
Q: What is the difference between running the code in a Python CLI and running it with the garak
command?
A: When running the code in a Python CLI, it executes successfully. However, when running it with the garak
command, it fails with the error message "no lexicon found with lang=None and lexicon='oewn:2023'". This suggests that there may be a configuration issue with the garak
command or the topic
probes.
Q: How do I check the lexicon file?
A: To check the lexicon file, follow these steps:
- Verify File Existence: Check if the lexicon file exists in the correct location.
- Check File Configuration: Verify that the lexicon file is correctly configured and contains the necessary information.
- Check File Format: Check if the lexicon file is in the correct format and can be read by the
Wordnet
class.
Q: How do I check language support?
A: To check language support, follow these steps:
- Check Class Documentation: Check the documentation for the
Wordnet
class to see if it supports the specified language. - Check Language List: Check the list of supported languages for the
Wordnet
class to see if the specified language is included. - Check Language Configuration: Verify that the language is correctly configured in the
garak
command andtopic
probes.
Q: How do I check the configuration?
A: To check the configuration, follow these steps:
- Review Command Options: Review the options for the
garak
command to ensure that everything is correctly set up. - Review Probe Configuration: Review the configuration for the
topic
probes to ensure that everything is correctly set up. - Check Configuration Files: Check the configuration files for the
garak
command andtopic
probes to ensure that everything is correctly set up.
Q: How do I run the garak
command in debug mode?
A: To run the garak
command in debug mode, follow steps:
- Add Debug Option: Add the
--debug
option to thegarak
command. - Run Command: Run the
garak
command with the--debug
option. - Check Output: Check the output of the command to see if it provides more detailed error messages and stack traces.