File: common/src/common/database/influxdb.py line 491
Code:
try:
query_results = api_queryfcast.query_data_frame(query)
except Exception as e:
logger.info("An error occurred while querying data: %s", e)
if query_results.empty: # ← NameError if exception was raised above
Problem:
query_results is assigned inside the try block only. If the InfluxDB query
raises an exception, query_results is never defined. Execution continues to
query_results.empty and raises NameError — silently crashing the data API.
Fix:
Initialize before the try block:
query_results = None
try:
query_results = api_queryfcast.query_data_frame(query)
except Exception as e:
logger.info(...)
return {"error": "The InfluxDB query failed to execute."}
if query_results is None or query_results.empty:
Same pattern as predictive-control issue #3 (grap_info unbound).
Found via AST analysis — COBALT formal verification engine.
Reported by: Dominik Blain — COBALT verification
File: common/src/common/database/influxdb.py line 491
Code:
try:
query_results = api_queryfcast.query_data_frame(query)
except Exception as e:
logger.info("An error occurred while querying data: %s", e)
Problem:
query_resultsis assigned inside the try block only. If the InfluxDB queryraises an exception,
query_resultsis never defined. Execution continues toquery_results.emptyand raises NameError — silently crashing the data API.Fix:
Initialize before the try block:
query_results = None
try:
query_results = api_queryfcast.query_data_frame(query)
except Exception as e:
logger.info(...)
return {"error": "The InfluxDB query failed to execute."}
Same pattern as predictive-control issue #3 (grap_info unbound).
Found via AST analysis — COBALT formal verification engine.
Reported by: Dominik Blain — COBALT verification