Fix Traceback meeting.import

Open
#3,884 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

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

Research direction

The traceback points to prefetch in openslides_backend/action/actions/meeting/import_.py (around line 144), called from perform (around line 100). Check what shape action_data has when committee_id is missing, and how the import payload schema is meant to require it. Done means a request without committee_id gets a proper validation error instead of a 500 KeyError, or the missing key is handled deliberately, with a test covering that case.

Written by the indexing model from the issue text.

Description

bug
INFO:openslides_backend.shared.handlers.base_handler:Performing action meeting.import.
[ERROR] Error handling request POST /system/action/handle_request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/gunicorn/workers/gthread.py", line 516, in handle
    return self._keepalive_after(conn, self.handle_request(req, conn))
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/gunicorn/workers/gthread.py", line 712, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/openslides_backend/http/application.py", line 164, in __call__
    return self.wsgi_application(environ, start_response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/openslides_backend/http/application.py", line 154, in wsgi_application
    response = self.dispatch_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/openslides_backend/http/application.py", line 103, in dispatch_request
    response_body, access_token = view_instance.dispatch(request)
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/openslides_backend/http/views/base_view.py", line 121, in dispatch
    return func(request)
           ^^^^^^^^^^^^^
  File "/app/openslides_backend/http/views/action_view.py", line 56, in action_route
    response = handle_action_in_worker_thread(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/openslides_backend/action/action_worker.py", line 94, in handle_action_in_worker_thread
    raise action_worker_thread.exception
  File "/app/openslides_backend/action/action_worker.py", line 265, in run
    self.response = self.handler.handle_request(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/openslides_backend/action/action_handler.py", line 142, in handle_request
    results = self.execute_write_requests(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/openslides_backend/action/action_handler.py", line 234, in execute_write_requests
    write_requests, data = get_write_requests(*args)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/openslides_backend/action/action_handler.py", line 284, in parse_actions
    write_request, results = self.perform_action(
                             ^^^^^^^^^^^^^^^^^^^^
  File "/app/openslides_backend/action/action_handler.py", line 333, in perform_action
    write_request, results = action.perform(
                             ^^^^^^^^^^^^^^^
  File "/app/openslides_backend/action/actions/meeting/import_.py", line 100, in perform
    self.prefetch(action_data)
  File "/app/openslides_backend/action/actions/meeting/import_.py", line 144, in prefetch
    list({instance["committee_id"] for instance in action_data}),
          ~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'committee_id'
Dominant language
Python
Stars
9
Forks
41
Avg merge
1d 20h
Merged PRs (30d)
48

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

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 OpenSlides/openslides-backend

All issues in OpenSlides/openslides-backend

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.