Skip to content

ValueError: too many values to unpack when a tree rank has a space in it #6459

@grantfitzsimmons

Description

@grantfitzsimmons

Describe the bug
A clear and concise description of what the bug is.

To Reproduce

You can immediately verify this issue by going to http://localhost/specify/query/5/ (the "Label Fields" query) and running it. This will result in an immediate error.

Steps to reproduce the behavior:

  1. Login to the os database as specifyadmin
  2. Go to the Reports menu
  3. Click on OSU Types Large and select the record set named "1506"
  4. See error
specify7-1         | [30/Apr/2025 09:46:40] [ERROR] [django.request:224] Internal Server Error: /report_runner/run/
specify7-1         | Traceback (most recent call last):
specify7-1         |   File "/opt/specify7/ve/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
specify7-1         |     response = get_response(request)
specify7-1         |   File "/opt/specify7/ve/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
specify7-1         |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
specify7-1         |   File "/opt/specify7/ve/lib/python3.8/site-packages/django/views/decorators/http.py", line 40, in inner
specify7-1         |     return func(request, *args, **kwargs)
specify7-1         |   File "/opt/specify7/specifyweb/specify/views.py", line 35, in wrapped
specify7-1         |     return view(request, *args, **kwargs)
specify7-1         |   File "/opt/specify7/specifyweb/report_runner/views.py", line 52, in run
specify7-1         |     report_data = run_query(request.specify_collection, request.specify_user, request.POST['query'])
specify7-1         |   File "/opt/specify7/specifyweb/report_runner/views.py", line 205, in run_query
specify7-1         |     query_result = run_ephemeral_query(collection, user, spquery)
specify7-1         |   File "/opt/specify7/specifyweb/stored_queries/execution.py", line 542, in run_ephemeral_query
specify7-1         |     field_specs = fields_from_json(spquery["fields"])
specify7-1         |   File "/opt/specify7/specifyweb/stored_queries/queryfield.py", line 28, in fields_from_json
specify7-1         |     field_specs = [
specify7-1         |   File "/opt/specify7/specifyweb/stored_queries/queryfield.py", line 29, in <listcomp>
specify7-1         |     QueryField.from_spqueryfield(ephemeral_field_from_json(data))
specify7-1         |   File "/opt/specify7/specifyweb/stored_queries/queryfield.py", line 49, in from_spqueryfield
specify7-1         |     fieldspec = QueryFieldSpec.from_stringid(field.stringId, field.isRelFld)
specify7-1         |   File "/opt/specify7/specifyweb/stored_queries/queryfieldspec.py", line 188, in from_stringid
specify7-1         |     tree_rank_name, field = find_tree_and_field(node, extracted_fieldname)
specify7-1         |   File "/opt/specify7/specifyweb/stored_queries/queryfieldspec.py", line 87, in find_tree_and_field
specify7-1         |     tree_rank, tree_field = tree_rank_and_field
specify7-1         | ValueError: too many values to unpack (expected 2)

This only happens on v7.10.2, not v7.10.1.

It seems to be fixed in v7.10.3...

Expected behavior
This report should run without incident.

Screenshots

Image

Crash Report

Using macOS, Arc browser– reported on Windows using Chrome

Specify 7 Version:v7.10.2
Git SHA:4618ba9a86858a249c45c9d781f2e54e79a147a8 (opens in a new tab)
Build Date:7 days ago
Specify 6 Version:6.8.03
Database Version:6.8.03
DB Schema Version:2.10
Database Name:os
DB Creation Date:Friday, January 29, 2010 at 11:37:57 AM CST
Institution:Oregon State University
Discipline:Ichthyology
Collection:Oregon State Ichthyology Collection
ISA Number:N/A
Browser:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36

Specify 7 System Information - 2025-04-30T14_39_37.107Z.txt

Reported By
Alvaro Cortes at Oregon State:

Quick follow-up: It looks like I can’t print labels at this time. Is that part of the fix going on?
Attached is a screenshot of the error message I get when I select to print a label under our standard formats.

Metadata

Metadata

Assignees

Labels

2 - ReportsIssues that are related to reports and labelsregressionThis is behavior that once worked that has broken. Must be resolved before the next release.

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions