encoding a pandapower.control.util.characteristic.Characteristic to BSON fails. Since saving and loading the corresponding grid model works, the JSON converter is working. Therefore this seems to be a problem in pandahub. It happened with a model which uses q_capability_characteristics for sgens.
2026-06-03 09:58:45,455 - ERROR - Invalid document: cannot encode object: Characteristic, of type: <class 'pandapower.control.util.characteristic.Characteristic'>
Traceback (most recent call last):
File "async_mongo_api.py", line 250, in write_network
await asyncio.gather(*coros)
File "async_mongo_api.py", line 174, in _insert_many_with_semaphore
return await collection.insert_many(data, ordered=False, bypass_document_validation=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "miniconda3\envs\cgmes\Lib\concurrent\futures\thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "miniconda3\envs\cgmes\Lib\site-packages\pymongo\_csot.py", line 125, in csot_wrapper
return func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "miniconda3\envs\cgmes\Lib\site-packages\pymongo\synchronous\collection.py", line 975, in insert_many
blk.execute(write_concern, session, _Op.INSERT)
File "miniconda3\envs\cgmes\Lib\site-packages\pymongo\synchronous\bulk.py", line 751, in execute
return self.execute_command(generator, write_concern, session, operation)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "miniconda3\envs\cgmes\Lib\site-packages\pymongo\synchronous\bulk.py", line 604, in execute_command
_ = client._retryable_write(
^^^^^^^^^^^^^^^^^^^^^^^^
File "miniconda3\envs\cgmes\Lib\site-packages\pymongo\synchronous\mongo_client.py", line 2083, in _retryable_write
return self._retry_with_session(retryable, func, s, bulk, operation, operation_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "miniconda3\envs\cgmes\Lib\site-packages\pymongo\synchronous\mongo_client.py", line 1968, in _retry_with_session
return self._retry_internal(
^^^^^^^^^^^^^^^^^^^^^
File "miniconda3\envs\cgmes\Lib\site-packages\pymongo\_csot.py", line 125, in csot_wrapper
return func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mvogt\miniconda3\envs\cgmes\Lib\site-packages\pymongo\synchronous\mongo_client.py", line 2014, in _retry_internal
).run()
^^^^^
File "miniconda3\envs\cgmes\Lib\site-packages\pymongo\synchronous\mongo_client.py", line 2763, in run
return self._read() if self._is_read else self._write()
^^^^^^^^^^^^^
File "miniconda3\envs\cgmes\Lib\site-packages\pymongo\synchronous\mongo_client.py", line 2895, in _write
return self._func(self._session, conn, self._retryable) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "miniconda3\envs\cgmes\Lib\site-packages\pymongo\synchronous\bulk.py", line 593, in retryable_bulk
self._execute_command(
File "miniconda3\envs\cgmes\Lib\site-packages\pymongo\synchronous\bulk.py", line 538, in _execute_command
result, to_send = self._execute_batch(bwc, cmd, ops, client)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "miniconda3\envs\cgmes\Lib\site-packages\pymongo\synchronous\bulk.py", line 461, in _execute_batch
request_id, msg, to_send = bwc.batch_command(cmd, ops)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "miniconda3\envs\cgmes\Lib\site-packages\pymongo\message.py", line 699, in batch_command
request_id, msg, to_send = _do_batched_op_msg(
^^^^^^^^^^^^^^^^^^^
File "miniconda3\envs\cgmes\Lib\site-packages\pymongo\message.py", line 926, in _do_batched_op_msg
return _batched_op_msg(operation, command, docs, ack, opts, ctx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
bson.errors.InvalidDocument: Invalid document: cannot encode object: Characteristic, of type: <class 'pandapower.control.util.characteristic.Characteristic'>
Hi,
encoding a pandapower.control.util.characteristic.Characteristic to BSON fails. Since saving and loading the corresponding grid model works, the JSON converter is working. Therefore this seems to be a problem in pandahub. It happened with a model which uses q_capability_characteristics for sgens.
Stacktrace: