# Buggy code
def __init__(
    self,
    config_file,
    tool_source,
    app,
    guid=None,
    repository_id=None,
    allow_code_files=True,
):
    """Load a tool from the config named by `config_file`"""
    # Determine the full path of the directory where the tool config is
    self.config_file = config_file
    self.tool_dir = os.path.dirname(config_file)
    self.app = app
    self.repository_id = repository_id
    self._allow_code_files = allow_code_files
    # setup initial attribute values
    self.inputs = odict()
    self.stdio_exit_codes = list()
    self.stdio_regexes = list()
    self.inputs_by_page = list()
    self.display_by_page = list()
    self.action = "/tool_runner/index"
    self.target = "galaxy_main"
    self.method = "post"
    self.labels = []
    self.check_values = True
    self.nginx_upload = False
    self.input_required = False
    self.display_interface = True
    self.require_login = False
    self.rerun = False
    # Define a place to keep track of all input   These
    # differ from the inputs dictionary in that inputs can be page
    # elements like conditionals, but input_params are basic form
    # parameters like SelectField objects.  This enables us to more
    # easily ensure that parameter dependencies like index files or
    # tool_data_table_conf.xml entries exist.
    self.input_params = []
    # Attributes of tools installed from Galaxy tool sheds.
    self.tool_shed = None
    self.repository_name = None
    self.repository_owner = None
    self.changeset_revision = None
    self.installed_changeset_revision = None
    self.sharable_url = None
    # The tool.id value will be the value of guid, but we'll keep the
    # guid attribute since it is useful to have.
    self.guid = guid
    self.old_id = None
    self.version = None
    self._lineage = None
    self.dependencies = []
    # populate toolshed repository info, if available
    self.populate_tool_shed_info()
    # add tool resource parameters
    self.populate_resource_parameters(tool_source)
    # Parse XML element containing configuration
    try:
        self.parse(tool_source, guid=guid)
    except Exception as e:
        global_tool_errors.add_error(config_file, "Tool Loading", e)
        raise e
    # The job search is only relevant in a galaxy context, and breaks
    # loading tools into the toolshed for validation.
    if self.app.name == "galaxy":
        self.job_search = JobSearch(app=self.app)


# Traceback (KeyError)
galaxy.tools.toolbox.base INFO 2018-08-09 10:57:04,513 Parsing the tool configuration /private/var/folders/df/6xqpqpcd7h73b6jpx9t6cwhw0000gn/T/tmpicezz6xb/tool_conf.xml
galaxy.tools.toolbox.base ERROR 2018-08-09 10:57:04,519 Error reading tool from path: /Users/mvandenb/src/tools-iuc/tools/fastp/fastp.xml
Traceback (most recent call last):
File "/private/var/folders/df/6xqpqpcd7h73b6jpx9t6cwhw0000gn/T/tmpicezz6xb/galaxy-dev/lib/galaxy/tools/toolbox/base.py", line 567, in _load_tool_tag_set
tool = self.load_tool(concrete_path, use_cached=False)
File "/private/var/folders/df/6xqpqpcd7h73b6jpx9t6cwhw0000gn/T/tmpicezz6xb/galaxy-dev/lib/galaxy/tools/toolbox/base.py", line 751, in load_tool
tool = self.create_tool(config_file=config_file, repository_id=repository_id, guid=guid, **kwds)
File "/private/var/folders/df/6xqpqpcd7h73b6jpx9t6cwhw0000gn/T/tmpicezz6xb/galaxy-dev/lib/galaxy/tools/__init__.py", line 270, in create_tool
raise e
KeyError: 'adapter_trimming_options'

# Fixed code
def __init__(
    self,
    config_file,
    tool_source,
    app,
    guid=None,
    repository_id=None,
    allow_code_files=True,
):
    """Load a tool from the config named by `config_file`"""
    # Determine the full path of the directory where the tool config is
    self.config_file = config_file
    self.tool_dir = os.path.dirname(config_file)
    self.app = app
    self.repository_id = repository_id
    self._allow_code_files = allow_code_files
    # setup initial attribute values
    self.inputs = odict()
    self.stdio_exit_codes = list()
    self.stdio_regexes = list()
    self.inputs_by_page = list()
    self.display_by_page = list()
    self.action = "/tool_runner/index"
    self.target = "galaxy_main"
    self.method = "post"
    self.labels = []
    self.check_values = True
    self.nginx_upload = False
    self.input_required = False
    self.display_interface = True
    self.require_login = False
    self.rerun = False
    # Define a place to keep track of all input   These
    # differ from the inputs dictionary in that inputs can be page
    # elements like conditionals, but input_params are basic form
    # parameters like SelectField objects.  This enables us to more
    # easily ensure that parameter dependencies like index files or
    # tool_data_table_conf.xml entries exist.
    self.input_params = []
    # Attributes of tools installed from Galaxy tool sheds.
    self.tool_shed = None
    self.repository_name = None
    self.repository_owner = None
    self.changeset_revision = None
    self.installed_changeset_revision = None
    self.sharable_url = None
    # The tool.id value will be the value of guid, but we'll keep the
    # guid attribute since it is useful to have.
    self.guid = guid
    self.old_id = None
    self.version = None
    self._lineage = None
    self.dependencies = []
    # populate toolshed repository info, if available
    self.populate_tool_shed_info()
    # add tool resource parameters
    self.populate_resource_parameters(tool_source)
    self.tool_errors = None
    # Parse XML element containing configuration
    try:
        self.parse(tool_source, guid=guid)
    except Exception as e:
        global_tool_errors.add_error(config_file, "Tool Loading", e)
        raise e
    # The job search is only relevant in a galaxy context, and breaks
    # loading tools into the toolshed for validation.
    if self.app.name == "galaxy":
        self.job_search = JobSearch(app=self.app)