Summary
Eight POST endpoints in API/Routes/DataFile/DataFileRoute.py crash with UnboundLocalError when the request body sends null for casename or modelname.
The pattern: each route checks if casename != None: and only assigns response inside that block. When casename is None, the block is skipped but return jsonify(response) still executes - response was never defined, so Python raises UnboundLocalError and Flask returns a raw 500 with a full stack trace.
Affected routes: generateDataFile, createCaseRun, updateCaseRun, deleteScenarioCaseRuns, saveView, updateViews, batchRun, cleanUp.
This is the same bug class that #252 reported and PR #253 fixed - but PR #253 only patched readDataFile and validateInputs, leaving the other eight routes unguarded. Issue #288 later reported the batchRun crash separately, confirming the incomplete coverage.
What did you expect? (optional)
No response
How can we reproduce it?
curl -X POST http://127.0.0.1:5002/generateDataFile
-H "Content-Type: application/json"
-d '{"casename": null, "caserunname": "test"}'
Returns: 500 Internal Server Error with UnboundLocalError stack trace.
Expected: 400 Bad Request with JSON error message.
Same crash on: /createCaseRun, /updateCaseRun, /deleteScenarioCaseRuns,
/saveView, /updateViews, /batchRun, /cleanUp.
Environment (optional)
Branch: main @ 5f8f89a
File: API/Routes/DataFile/DataFileRoute.py
Logs or screenshots (optional)
No response
Related issue, PR, or discussion (optional)
Proposed track
None
Summary
Eight POST endpoints in
API/Routes/DataFile/DataFileRoute.pycrash withUnboundLocalErrorwhen the request body sendsnullforcasenameormodelname.The pattern: each route checks
if casename != None:and only assignsresponseinside that block. WhencasenameisNone, the block is skipped butreturn jsonify(response)still executes -responsewas never defined, so Python raisesUnboundLocalErrorand Flask returns a raw 500 with a full stack trace.Affected routes:
generateDataFile,createCaseRun,updateCaseRun,deleteScenarioCaseRuns,saveView,updateViews,batchRun,cleanUp.This is the same bug class that #252 reported and PR #253 fixed - but PR #253 only patched
readDataFileandvalidateInputs, leaving the other eight routes unguarded. Issue #288 later reported thebatchRuncrash separately, confirming the incomplete coverage.What did you expect? (optional)
No response
How can we reproduce it?
curl -X POST http://127.0.0.1:5002/generateDataFile
-H "Content-Type: application/json"
-d '{"casename": null, "caserunname": "test"}'
Returns: 500 Internal Server Error with UnboundLocalError stack trace.
Expected: 400 Bad Request with JSON error message.
Same crash on: /createCaseRun, /updateCaseRun, /deleteScenarioCaseRuns,
/saveView, /updateViews, /batchRun, /cleanUp.
Environment (optional)
Branch: main @ 5f8f89a
File: API/Routes/DataFile/DataFileRoute.py
Logs or screenshots (optional)
No response
Related issue, PR, or discussion (optional)
modelnameorcasenameisNonein DataFileRoute Endpoints #252 (original report, closed by PR fix: validate casename to prevent UnboundLocalError crashes (fixes #252) #253 fix was incomplete)/batchRuncrashes withUnboundLocalErrorwhenmodelnameis null #288 (batchRun crash, same root cause)Proposed track
None