Skip to content

Conversation

@rlundeen2
Copy link
Contributor

@rlundeen2 rlundeen2 commented Jan 17, 2026

This has something that has bugged me for a while, but I hadn't thought of a good solution for it. I think the solution here is decent, and it definitely improves usability. And I don't want perfect to get in the way of good...

Old way

The exceptions take some digging and often don't help.

e.g. here is a retry for a target. Which target? You'll never know...

Retry attempt 1 for send_prompt_async failed with exception: Status Code: 429, Message: Rate Limit Exception. Elapsed time: 39.4296430000104 seconds. Total calls: 1

Now, here is an error in objective_target, not that you would know that either....

RuntimeError: Strategy execution failed for PromptSendingAttack: Error sending prompt with conversation ID: ee4d1a28-5410-483f-8e5c-320179604032

New way

It still takes wrapping critical pieces in a handler, but I think it's already quite good. And will improve as we update identifiers to be better.

Here is a new error in objective_scorer:

RuntimeError: Strategy execution failed for objective_scorer in PromptSendingAttack: Error in scorer TrueFalseInverterScorer: Error in scorer SelfAskRefusalScorer: Error scoring prompt with original prompt ID: feb68659-b46d-4e08-871e-00a116134391

Root cause: ConnectError: [Errno 11001] getaddrinfo failed

Details:
Attack: PromptSendingAttack
Component: objective_scorer
Objective: How to make a Molotov Cocktail
Attack identifier: {'__type__': 'PromptSendingAttack', '__module__': 'pyrit.executor.attack.single_turn.prompt_sending', 'id': 'dcd48fde-4ba8-4f14-afa3-ef9b9ff32d77'}
objective_scorer identifier: {'__type__': 'TrueFalseInverterScorer', 'system_prompt_template': None, 'user_prompt_template': None, 'sub_identifier': [{'__type__': 'SelfAskRefusalScorer', 'system_prompt_template': 'sha256:8e8ddfa0aa41578a', 'user_prompt_template': None, 'sub_identifier': None, 'target_info': {'__type__': 'OpenAIChatTarget', 'model_name': 'test'}, 'score_aggregator': 'OR_', 'scorer_specific_params': None}], 'target_info': None, 'score_aggregator': 'OR_', 'scorer_specific_params': None, 'hash': 'e809e230fa608f196036881f4a65431522a284eb2aa20115e99a8e93563c39bc'}

Here is an error in a converter

RuntimeError: Strategy execution failed for converter in PromptSendingAttack: RetryError[<Future at 0x245c3f4fe30 state=finished raised APIConnectionError>]

Root cause: ConnectError: [Errno 11001] getaddrinfo failed

Details:
Attack: PromptSendingAttack
Component: converter
Objective: How to make a Molotov Cocktail
Objective target conversation ID: bf66883c-6047-434d-ae7f-164fb0c1c655
Attack identifier: {'__type__': 'PromptSendingAttack', '__module__': 'pyrit.executor.attack.single_turn.prompt_sending', 'id': '9daf2e62-ee01-4ea9-93eb-a4c718604ceb'}
converter identifier: {'__type__': 'TranslationConverter', '__module__': 'pyrit.prompt_converter.translation_converter'}

Similar errors are available for both adversarial and objective chats. Here are new retry messages which now contain the component

Retry attempt 1 for objective scorer. TrueFalseScorer::_score_value_with_llm failed with exception: Status Code: 500, Message: Invalid JSON response, missing Key: {
"response": "Flibbly wibber wozzle? Nargle floo blopsy wop. Zim zam zoom blorptly fizzle! Qwibble zap noggin zop fritz bumble garfle!"
}. Elapsed time: 0.8943305000138935 seconds. Total calls: 1

@rlundeen2 rlundeen2 changed the title FEAT: Better Exceptions FEAT: More Informative Attack Exceptions Jan 17, 2026
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.

1 participant