# Buggy code
def process_signatures(self, params):
    """Handle signature response."""
    try:
        signature_params = params["params"]
        if signature_params is not None and "activeParameter" in signature_params:
            self.sig_signature_invoked.emit(signature_params)
            signature_data = signature_params["signatures"]
            documentation = signature_data["documentation"]

            # The language server returns encoded text with
            # spaces defined as `\xa0`
            documentation = documentation.replace("\xa0", " ")

            parameter_idx = signature_params["activeParameter"]
            parameters = signature_data["parameters"]
            parameter_data = parameters[parameter_idx]

            signature = signature_data["label"]
            parameter = parameter_data["label"]

            # This method is part of spyder/widgets/mixins
            self.show_calltip(
                signature=signature,
                parameter=parameter,
                language=self.language,
                documentation=documentation,
            )
    except RuntimeError:
        # This is triggered when a codeeditor instance has been
        # removed before the response can be processed.
        return
    except Exception:
        self.log_lsp_handle_errors("Error when processing signature")


# Traceback (IndexError)
File "/home/ok97465/python/spyder/spyder/plugins/editor/widgets/codeeditor.py", line 1132, in process_signatures
parameter_data = parameters[parameter_idx]
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ok97465/anaconda3/lib/python3.7/logging/__init__.py", line 1034, in emit
msg = self.format(record)
File "/home/ok97465/anaconda3/lib/python3.7/logging/__init__.py", line 880, in format
return fmt.format(record)
File "/home/ok97465/anaconda3/lib/python3.7/logging/__init__.py", line 619, in format
record.message = record.getMessage()
File "/home/ok97465/anaconda3/lib/python3.7/logging/__init__.py", line 380, in getMessage
msg = msg % self.args
ValueError: incomplete format
Call stack:
File "bootstrap.py", line 186, in <module>
start.main()
File "/home/ok97465/python/spyder/spyder/app/start.py", line 195, in main
mainwindow.main()
File "/home/ok97465/python/spyder/spyder/app/mainwindow.py", line 3628, in main
mainwindow = run_spyder(app, options, args)
File "/home/ok97465/python/spyder/spyder/app/mainwindow.py", line 3511, in run_spyder
app.exec_()
File "/home/ok97465/python/spyder/spyder/plugins/completion/plugin.py", line 138, in receive_response
self.gather_and_send(request_responses)
File "/home/ok97465/python/spyder/spyder/plugins/completion/plugin.py", line 189, in gather_and_send
response_instance.handle_response(req_type, responses)
File "/home/ok97465/python/spyder/spyder/plugins/editor/widgets/codeeditor.py", line 915, in handle_response
handler(params)
File "/home/ok97465/python/spyder/spyder/plugins/editor/widgets/codeeditor.py", line 1149, in process_signatures
self.log_lsp_handle_errors("Error when processing signature")
File "/home/ok97465/python/spyder/spyder/plugins/editor/widgets/codeeditor.py", line 946, in log_lsp_handle_errors
logger.error('%', 1, stack_info=True)
Message: '%'
Arguments: (1,)

# Fixed code
def process_signatures(self, params):
    """Handle signature response."""
    try:
        signature_params = params["params"]
        if signature_params is not None and "activeParameter" in signature_params:
            self.sig_signature_invoked.emit(signature_params)
            signature_data = signature_params["signatures"]
            documentation = signature_data["documentation"]

            # The language server returns encoded text with
            # spaces defined as `\xa0`
            documentation = documentation.replace("\xa0", " ")

            parameter_idx = signature_params["activeParameter"]
            parameters = signature_data["parameters"]
            parameter = None

            if len(parameters) > 0:
                parameter_data = parameters[parameter_idx]
                parameter = parameter_data["label"]

            signature = signature_data["label"]

            # This method is part of spyder/widgets/mixins
            self.show_calltip(
                signature=signature,
                parameter=parameter,
                language=self.language,
                documentation=documentation,
            )
    except RuntimeError:
        # This is triggered when a codeeditor instance has been
        # removed before the response can be processed.
        return
    except Exception:
        self.log_lsp_handle_errors("Error when processing signature")