Component and version
OpenTelemetry Collector config builder 0.1.0, repository main at f8e907b92dabe47232978023fdcb01e2a7d4b752.
Description
load_model_costs() catches pydantic.ValidationError and prints that the model is being skipped, but then unconditionally executes costs.append(cost). If the first row is invalid, cost is unbound and the loader raises UnboundLocalError. If an invalid row follows a valid one, the previous model can be appended a second time. The loader is called while rendering the OpenTelemetry Collector processor configuration, so an invalid price row stops configuration generation.
Reproduction
Call load_model_costs() with a temporary model_prices.json whose first entry has invalid required data, such as a zero input cost. The existing validator maps zero to None, and the required input field raises ValidationError; the loader prints its skip warning and then raises UnboundLocalError at costs/__init__.py:119.
Expected behavior
Invalid rows are omitted and loading continues without duplicating a prior model. If invalid rows are intended to be fatal, return a clear validation error instead of logging that the row was skipped.
Environment and validation
Reproduced against repository main at the commit above using Python 3.13 and a temporary JSON fixture; no repository files were changed. The focused builder test module had 9 passing tests; its 2 integration failures require the absent tokencost installation, which was not installed.
Component and version
OpenTelemetry Collector config builder 0.1.0, repository
mainatf8e907b92dabe47232978023fdcb01e2a7d4b752.Description
load_model_costs()catchespydantic.ValidationErrorand prints that the model is being skipped, but then unconditionally executescosts.append(cost). If the first row is invalid,costis unbound and the loader raisesUnboundLocalError. If an invalid row follows a valid one, the previous model can be appended a second time. The loader is called while rendering the OpenTelemetry Collector processor configuration, so an invalid price row stops configuration generation.Reproduction
Call
load_model_costs()with a temporarymodel_prices.jsonwhose first entry has invalid required data, such as a zero input cost. The existing validator maps zero toNone, and the required input field raisesValidationError; the loader prints its skip warning and then raisesUnboundLocalErroratcosts/__init__.py:119.Expected behavior
Invalid rows are omitted and loading continues without duplicating a prior model. If invalid rows are intended to be fatal, return a clear validation error instead of logging that the row was skipped.
Environment and validation
Reproduced against repository main at the commit above using Python 3.13 and a temporary JSON fixture; no repository files were changed. The focused builder test module had 9 passing tests; its 2 integration failures require the absent
tokencostinstallation, which was not installed.