Skip to content

Fixed handling of missing definitions for dynamic search quantities.

Markus Scheidgen requested to merge nexus-search-fix into develop

The problem manifests with this stack trace:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.9/site-packages/nomad/app/v1/main.py", line 102, in __call__
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/starlette/middleware/cors.py", line 83, in __call__
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
    raise exc
  File "/usr/local/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in __call__
    raise e
  File "/usr/local/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in __call__
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 718, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 66, in app
    response = await func(request)
  File "/usr/local/lib/python3.9/site-packages/fastapi/routing.py", line 241, in app
    raw_response = await run_endpoint_function(
  File "/usr/local/lib/python3.9/site-packages/fastapi/routing.py", line 167, in run_endpoint_function
    return await dependant.call(**values)
  File "/usr/local/lib/python3.9/site-packages/nomad/app/v1/routers/uploads.py", line 840, in get_upload_entries
    metadata_entries = search(
  File "/usr/local/lib/python3.9/site-packages/nomad/search.py", line 1941, in search
    data=[
  File "/usr/local/lib/python3.9/site-packages/nomad/search.py", line 1942, in <listcomp>
    _es_to_entry_dict(hit, required, requires_filtering, doc_type)
  File "/usr/local/lib/python3.9/site-packages/nomad/search.py", line 590, in _es_to_entry_dict
    definition = get_definition(path)
  File "/usr/local/lib/python3.9/site-packages/nomad/search.py", line 718, in get_definition
    root = root.all_sub_sections[part].sub_section
KeyError: 'energy_calibration'
Edited by Markus Scheidgen

Merge request reports