E-CE0016 — Dict key not found

Error Type

Compile Error

Phase

compiling the problem into an OMMX instance

Python exception

ValueError

Message

Dict key `{value}` was not found in the dict.

Possible fix: make sure an entry with this key exists in the data.

Cause

A dict-typed value was subscripted with a key that is not present in the dict: the key has a supported type (integer, string, or tuple of integers/strings), but no entry with that key exists in the data. Keys of an unsupported type are reported as E-TE0500 instead.

Fix

Make sure the key actually exists in the data (or in the declared key set) for every combination the model iterates over, e.g. by iterating over the dict’s own keys instead of an independent range.