Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Error: <h1>Server Error (500)</h1>' when trying to generate reports page #2109

Open
mdestaubin opened this issue Dec 5, 2018 · 0 comments · May be fixed by kobotoolbox/formpack#187
Open
Assignees
Labels
bug Things broken and not working as expected has PR

Comments

@mdestaubin
Copy link
Contributor

mdestaubin commented Dec 5, 2018

Blocked by kobotoolbox/formpack#185

This is a problem in formpack: https://sentry.kbtdev.org/kobo/kpi-backend/issues/1676/?query=user.username:harout7. See the traceback below. In this case, raw_values is طلال, which cannot be coerced into an integer. I [jnm] assume this happens because people reuse a question name while changing the type, but we must handle it more gracefully.

UnicodeEncodeError: 'decimal' codec can't encode characters in position 0-3: invalid decimal Unicode string
  File "django/core/handlers/base.py", line 132, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "rest_framework/viewsets.py", line 87, in view
    return self.dispatch(request, *args, **kwargs)
  File "rest_framework/views.py", line 466, in dispatch
    response = self.handle_exception(exc)
  File "rest_framework/views.py", line 463, in dispatch
    response = handler(request, *args, **kwargs)
  File "rest_framework/mixins.py", line 58, in retrieve
    return Response(serializer.data)
  File "rest_framework/serializers.py", line 239, in data
    self._data = self.to_representation(self.instance)
  File "kobo/apps/reports/serializers.py", line 27, in to_representation
    _list = report_data.data_by_identifiers(obj, vnames, split_by=split_by)
  File "kobo/apps/reports/report_data.py", line 178, in data_by_identifiers
    split_by=split_by)
  File "formpack/reporting/autoreport.py", line 209, in get_stats
    return self._calculate_stats(submissions, fields, self.versions, lang)
  File "formpack/reporting/autoreport.py", line 73, in _calculate_stats
    values = list(field.parse_values(raw_value))
  File "formpack/schema/fields.py", line 515, in parse_values
    yield int(raw_values)

Description

'This report cannot be loaded. Server Error (500) message' is showing when trying to generate a project report. However, the users experiencing this issue are still able to view the table and download the data within the same project.

Steps to Reproduce

  1. Log on to 'harout7' and view the reports page for project 'V2 استبيان الدراسة الأسرية النسخة النهائية'

Expected behavior

To view the project report.

Actual behavior

Error message 'This report cannot be loaded. Server Error (500) message' is shown instead.
image

Additional details

The most recent report of this bug comes from this support conversation -
https://app.intercom.io/a/apps/s6hn3a8q/inbox/inbox/conversation/19711539333

There is also a topic on the community forum dating back to September 2017 -
https://community.kobotoolbox.org/t/problem-in-generating-report-for-a-project-internal-server-error/881

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Things broken and not working as expected has PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants