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

{Tree}treedefitem matching query does not exist error when running a query with an invalid mapping #3340

Open
carlosmbe opened this issue Apr 12, 2023 · 4 comments
Labels
1 - Bug Incorrect behavior of the product 2 - Queries Issues that are related to the query builder or queries in general

Comments

@carlosmbe
Copy link
Contributor

carlosmbe commented Apr 12, 2023

Describe the bug
I assume this error is also caused by an unmapped field. However, after further analysis. The cause is the same but the message differs.

#3311 has "message":"Error: Tried to get unknown field

This has two stacked errors with the same message.
DoesNotExist at /stored_query/ephemeral/ Taxontreedefitem matching query does not exist

To Reproduce
Steps to reproduce the behavior:

  1. Go to NHMD Amber in NHMD Test as petrifiedroadkill
  2. Click on Queries
  3. Select down to Biocultural and press the query button
  4. See error

Expected behavior
Something more informative than an Error Alert Dialogue

Screen Recording and Crash Reports
Specify 7 Crash Report - 2023-04-12T21_24_09.575Z.txt
Specify 7 Crash Report - 2023-04-12T21_24_12.125Z.txt

SCR.SMAl.mp4

Desktop:

OS: Mac OSx Ventura
Browser: Chrome
Specify 7 Version: 7.8.10-prerelease

Database Name: NHMD Test

Reported By
Carlos @carlosmbe

@carlosmbe carlosmbe added 1 - Bug Incorrect behavior of the product pri:unknown labels Apr 12, 2023
@grantfitzsimmons
Copy link
Member

This bug is caused by an invalid item in this query:

image

https://nhmdtest030823-v7810-prerelease.test.specifysystems.org/specify/query/405/

user: petrifiedroadkill, col: NHMD Amber

If we reduce the query to just the not mapped item, the query looks like this:

{
	"id": 405,
	"contextname": "CollectionObject",
	"contexttableid": 1,
	"countonly": false,
	"formatauditrecids": false,
	"isfavorite": true,
	"name": "Not Mapped Query",
	"ordinal": 32767,
	"remarks": null,
	"searchsynonymy": false,
	"selectdistinct": false,
	"smushed": false,
	"sqlstr": null,
	"timestampcreated": "2023-04-14T13:46:52",
	"timestampmodified": "2023-04-14T13:46:52",
	"version": 0,
	"createdbyagent": "/api/specify/agent/2706/",
	"modifiedbyagent": null,
	"specifyuser": "/api/specify/specifyuser/1/",
	"reports": "/api/specify/spreport/?query=405",
	"resource_uri": "/api/specify/spquery/405/",
	"fields": [
		{
			"id": 4727,
			"allownulls": null,
			"alwaysfilter": null,
			"columnalias": null,
			"contexttableident": null,
			"endvalue": null,
			"fieldname": "Division",
			"formatname": null,
			"isdisplay": true,
			"isnot": false,
			"isprompt": null,
			"isrelfld": false,
			"operend": null,
			"operstart": 11,
			"position": 0,
			"sorttype": 0,
			"startvalue": "",
			"stringid": "1,9-determinations,4-preferredTaxon.taxon.Division",
			"tablelist": "1,9-determinations,4-preferredTaxon",
			"timestampcreated": "2023-04-14T13:46:52",
			"timestampmodified": "2023-04-14T13:46:52",
			"version": 0,
			"createdbyagent": "/api/specify/agent/2706/",
			"modifiedbyagent": null,
			"query": "/api/specify/spquery/405/",
			"mappings": "/api/specify/spexportschemaitemmapping/?queryfield=4727",
			"resource_uri": "/api/specify/spqueryfield/4727/"
		}
	]
}

Not Mapped Query.json.zip

It would be very nice if the query builder did not fail and instead registered the mapping as invalid. This is not an uncommon issue and I imagine this has manifested in other issues that already exist.

@grantfitzsimmons grantfitzsimmons changed the title Query Crash. Related to #3311 but different error message {Tree}treedefitem matching query does not exist error when running a query with an invalid mapping Apr 14, 2023
@grantfitzsimmons
Copy link
Member

image

It seems that Specify 7 is using Phylum and not Division where in Botany collections it should.

Mappings made in 6 expect Division, and mappings made in 7 expect Phylum (which is wrong when working with botany).

Made in 7 (stringid": "1,9-determinations,4-preferredTaxon.taxon.Phylum",)

		{
			"id": 4746,
			"allownulls": null,
			"alwaysfilter": null,
			"columnalias": null,
			"contexttableident": null,
			"endvalue": null,
			"fieldname": "Phylum",
			"formatname": null,
			"isdisplay": true,
			"isnot": false,
			"isprompt": null,
			"isrelfld": false,
			"operend": null,
			"operstart": 8,
			"position": 1,
			"sorttype": 0,
			"startvalue": "",
			"stringid": "1,9-determinations,4-preferredTaxon.taxon.Phylum",
			"tablelist": "1,9-determinations,4-preferredTaxon",
			"timestampcreated": "2023-04-14T16:07:46",
			"timestampmodified": "2023-04-14T16:07:46",
			"version": 0,
			"createdbyagent": "/api/specify/agent/2706/",
			"modifiedbyagent": null,
			"query": "/api/specify/spquery/405/",
			"mappings": "/api/specify/spexportschemaitemmapping/?queryfield=4746",
			"resource_uri": "/api/specify/spqueryfield/4746/"
		}

Made in 6 (stringid": "1,9-determinations,4-preferredTaxon.taxon.Division"):

		{
			"id": 4745,
			"allownulls": null,
			"alwaysfilter": null,
			"columnalias": null,
			"contexttableident": null,
			"endvalue": null,
			"fieldname": "Division",
			"formatname": null,
			"isdisplay": true,
			"isnot": false,
			"isprompt": null,
			"isrelfld": false,
			"operend": null,
			"operstart": 11,
			"position": 0,
			"sorttype": 0,
			"startvalue": "",
			"stringid": "1,9-determinations,4-preferredTaxon.taxon.Division",
			"tablelist": "1,9-determinations,4-preferredTaxon",
			"timestampcreated": "2023-04-14T16:07:46",
			"timestampmodified": "2023-04-14T16:07:46",
			"version": 0,
			"createdbyagent": "/api/specify/agent/2706/",
			"modifiedbyagent": null,
			"query": "/api/specify/spquery/405/",
			"mappings": "/api/specify/spexportschemaitemmapping/?queryfield=4745",
			"resource_uri": "/api/specify/spqueryfield/4745/"
		},

@emenslin
Copy link
Collaborator

Can recreate in edge (7.9.6)

@emenslin
Copy link
Collaborator

From #3311

Specify 7 Crash Report - 2023-11-16T05_57_56.569Z.txt

Screen.Recording.2023-11-15.at.11.58.07.PM.mov

The behavior mentioned in that comment seems to be the exact same as this issue so that is why I closed it
Current behavior:

lX3LdmGQJG.mp4

Specify 7 Crash Report - 2024-07-17T17_08_25.500Z.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - Bug Incorrect behavior of the product 2 - Queries Issues that are related to the query builder or queries in general
Projects
Status: 📋 Backlog
Development

No branches or pull requests

3 participants