You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DICOM endpoint crashes with ValueError: not enough values to unpack due to inconsistent extract_bids_metadata signatures #42
The DICOM processing endpoint expects get_bids_metadata() to return a tuple (metadata, asl_context). However, extract_bids_metadata() implementation varied across sequences: GE returned a tuple (metadata, asl_context), while Siemens returned only metadata (a dict). This inconsistency caused a ValueError: not enough values to unpack when processing Siemens DICOMs.
Reproduction (on main branch)
Reproducible Code (Python)
# reproduce_bug9.py — Run: .venv\Scripts\python.exe bug_9\reproduce_bug9.pyfrompyaslreport.mainimportget_bids_metadatafrompyaslreport.enums.modaliy_enumimportModalityTypeValuesimportunittest.mockasmock# Mock headers for GE vs Siemens# ...withmock.patch('pyaslreport.main.get_dicom_header', return_value=siemens_header):
# This will crash with ValueError on mainmetadata, asl_context=get_bids_metadata({"modality": ModalityTypeValues.ASL})
Script output on main branch
#
Test
Status
Detail
T1
GE extract_bids_metadata returns tuple
PASS
tuple
T2
Siemens extract_bids_metadata returns dict
PASS
dict
T3
get_bids_metadata for GE returns tuple
PASS
T4
get_bids_metadata for Siemens returns tuple
FAIL
CRASH: not enough values to unpack
Wait, why did T1/T2 pass on main? Because historically GE wrongly returned tuple, and Siemens correctly returned dict. The crash happens in T4 where get_bids_metadata tries to unpack the dict.
POST /api/report/process/dicom (Siemens DICOM)
Status: 500 Internal Server Error
Detail: "ValueError: not enough values to unpack (expected 2, got 1)"
>> VERDICT: Bug is PRESENT.
Note: This architectural fix follows the exact suggestion of mentor Jan Petr when this issue was originally raised by Devguru-codes in the previous repository (prior to OSIPI inclusion).
Activity