diff --git a/haystack/logging.py b/haystack/logging.py index 53387af72..5269f0b1b 100644 --- a/haystack/logging.py +++ b/haystack/logging.py @@ -192,7 +192,7 @@ def patch_make_records_to_use_kwarg_string_interpolation(original_make_records: safe_extra = extra or {} try: interpolated_msg = msg.format(**safe_extra) - except (KeyError, ValueError): + except (KeyError, ValueError, IndexError): interpolated_msg = msg return original_make_records(name, level, fn, lno, interpolated_msg, (), exc_info, func, extra, sinfo) diff --git a/releasenotes/notes/fix-logging-index-error-c58691db633542c5.yaml b/releasenotes/notes/fix-logging-index-error-c58691db633542c5.yaml new file mode 100644 index 000000000..aff6ccdb6 --- /dev/null +++ b/releasenotes/notes/fix-logging-index-error-c58691db633542c5.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - | + Fixed an index error in the logging module when arbitrary strings are logged.