Conversation
…ly events
The XRD/NMR/UVVis in-situ blocks trigger their async processing step by
posting a bare {"trigger_async": true} event from the webapp
(XRDInsituBlock.vue onFolderSelected/onGranularitySubmit, and the
equivalent NMR/UVVis handlers). This event carries no event_name key.
blocks.py schedules this as an async task and hands event_data straight
to the background worker, which calls block.process_events(event_data)
since the dict is truthy. process_events did event.pop("event_name")
with no default, so any event without an event_name key raised
KeyError: 'event_name', caught by the worker's outer handler and
recorded as "Error during processing: 'event_name'".
This fired unconditionally for every in-situ block use through the web
UI, regardless of the uploaded data. Fix: pop with a None default so
events with no event_name are treated as unregistered (i.e. ignored)
rather than raising.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018B6NG9uZJ66A6yMxpvaw4t
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In-situ XRD/NMR/UVVis blocks trigger their async processing step by sending a bare
{"trigger_async": true}event (noevent_name) from the webapp.DataBlock.process_eventsdid
event.pop("event_name")with no default, so this raisedKeyError: 'event_name',surfaced by the async worker as
Error during processing: 'event_name'— unconditionally,for every in-situ block use, regardless of the uploaded data.
Root cause chain
webapp/src/components/datablocks/XRDInsituBlock.vue(onFolderSelected/onGranularitySubmit)calls
updateBlockFromServer(..., { trigger_async: true })when folder names are set.The NMR/UVVis in-situ blocks do the same.
pydatalab/src/pydatalab/routes/v0_1/blocks.pyschedules this as an async task and passesevent_datastraight through to the background worker.block.process_events(event_data)sinceevent_datais truthy.pydatalab/src/pydatalab/blocks/base.py'sprocess_eventsdoesevent.pop("event_name")with no default →
KeyError: 'event_name', since the dict only hastrigger_async.Error during processing: 'event_name'.Fix
event.pop("event_name", None)— a control-only event is now treated as unregisteredand skipped rather than raising.
Test plan
test_process_events_ignores_events_without_event_name, covering the exact{"trigger_async": true}shape sent by the in-situ blocks.test_base_blockstill passes, confirming real events still dispatch correctly.web UI no longer errors, and the block loads.
🤖 Generated with Claude Code
https://claude.ai/code/session_018B6NG9uZJ66A6yMxpvaw4t