Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Backend bails out when submitting query without data source: `KeyError: 'datasource'`

Open Beginner friendly
#149 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
65/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
api, backend

Research direction

Start in patzilla/navigator/services/util.py, at query_expression_util_handler and make_expression_filter, where the traceback shows the missing 'datasource' key is accessed. Trace how the query request is validated and handled when no data source is selected, then add or update a focused test for that request. Done when submitting such a query no longer causes a backend KeyError.

Written by the indexing model from the issue text.

Description

Problem

Navigating around wildly, I have been able to submit a query without selecting a data source, which currently makes the backend bail out.

Details

2026-10-27 13:49:04,182 ERROR    [waitress                                ][waitress-2] Exception while serving /api/util/query-expression
Traceback (most recent call last):
  File "/path/to/site-packages/waitress/channel.py", line 430, in service
    task.service()
    ~~~~~~~~~~~~^^
  File "/path/to/site-packages/waitress/task.py", line 167, in service
    self.execute()
    ~~~~~~~~~~~~^^
  File "/path/to/site-packages/waitress/task.py", line 435, in execute
    app_iter = self.channel.server.application(environ, start_response)
  File "/path/to/site-packages/waitress/proxy_headers.py", line 64, in translate_proxy_headers
    return app(environ, start_response)
  File "/path/to/site-packages/paste/deploy/config.py", line 306, in __call__
    return self.app(environ, start_response)
           ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/site-packages/pyramid/router.py", line 274, in __call__
    response = self.execution_policy(environ, self)
  File "/path/to/site-packages/pyramid/router.py", line 283, in default_execution_policy
    return request.invoke_exception_view(reraise=True)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "/path/to/site-packages/pyramid/view.py", line 787, in invoke_exception_view
    reraise_(*exc_info)
    ~~~~~~~~^^^^^^^^^^^
  File "/path/to/site-packages/pyramid/_compat.py", line 178, in reraise
    raise value.with_traceback(tb)
  File "/path/to/site-packages/pyramid/router.py", line 281, in default_execution_policy
    return router.invoke_request(request)
           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/path/to/site-packages/pyramid/router.py", line 249, in invoke_request
    response = handle_request(request)
  File "/path/to/site-packages/pyramid/tweens.py", line 43, in excview_tween
    response = _error_handler(request, exc)
  File "/path/to/site-packages/pyramid/tweens.py", line 13, in _error_handler
    response = request.invoke_exception_view(exc_info)
  File "/path/to/site-packages/pyramid/view.py", line 774, in invoke_exception_view
    response = _call_view(
        registry,
    ...<7 lines>...
        request_iface=request_iface.combined,
    )
  File "/path/to/site-packages/pyramid/view.py", line 683, in _call_view
    response = view_callable(context, request)
  File "/path/to/site-packages/pyramid/viewderivers.py", line 401, in viewresult_to_response
    result = view(context, request)
  File "/path/to/site-packages/pyramid/tweens.py", line 41, in excview_tween
    response = handler(request)
  File "/path/to/site-packages/pyramid/router.py", line 147, in handle_request
    response = _call_view(
        registry, request, context, context_iface, view_name
    )
  File "/path/to/site-packages/pyramid/view.py", line 683, in _call_view
    response = view_callable(context, request)
  File "/path/to/site-packages/pyramid/config/views.py", line 169, in __call__
    return view(context, request)
  File "/path/to/site-packages/pyramid/config/views.py", line 188, in attr_view
    return view(context, request)
  File "/path/to/site-packages/pyramid/config/views.py", line 214, in predicate_wrapper
    return view(context, request)
  File "/path/to/site-packages/pyramid/viewderivers.py", line 436, in rendered_view
    result = view(context, request)
  File "/path/to/site-packages/pyramid/viewderivers.py", line 144, in _requestonly_view
    response = view(request)
  File "/path/to/site-packages/cornice/service.py", line 493, in wrapper
    response = view_(request)
  File "/path/to/patzilla/patzilla/navigator/services/util.py", line 60, in query_expression_util_handler
    expression_data = make_expression_filter(data)
  File "/path/to/patzilla/patzilla/navigator/services/util.py", line 69, in make_expression_filter
    datasource = data['datasource']
                 ~~~~^^^^^^^^^^^^^^
KeyError: 'datasource'
Dominant language
Python
Stars
123
Forks
31
Avg merge
1h 6m
Merged PRs (30d)
50

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ip-tools/patzilla

All issues in ip-tools/patzilla

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.