entities – How should a custom configuration entity define a dependency on other configuration?

In a custom module I am defining a defaults Configuration entity that references a role.
I would like to define a dependency on the role. This is my first attempt.

public function calculateDependencies() {
  $this->dependencies = parent::calculateDependencies();
  $this->addDependency('module', 'user');
  if (isset($this->role_id)) {
    $this->addDependency('config', "user.role.{$this->role_id}");
  return $this; // Also tried return $this->dependencies;

The Drupal documentation on dependencies references the Block configuration class that looks very similar:

  public function calculateDependencies() {
    $this->addDependency('theme', $this->theme);
    return $this;

However I am seeing an error shown below when trying to save the entity.The backtrace indicates it is coming from the attempt to add a dependency on the user module. I chose to add that dependency by taking an example from system.action.user_add_role_action.administrator.

PHP Error: Cannot use object of type Drupal/my_module/Entity/MyAccessDefaults as array in /app/web/core/lib/Drupal/Core/Entity/DependencyTrait.php on line 32

For example I am trying to test with this code:

$values = (
  'id' => 'administrator', 'label' => 'Administrator role grants', 
  'grant_type' => 'role', 'role_id' => "administrator", 
  'grants' => ('grant_view' => 1)
$default_admin_config = Drupal::entityTypeManager()->getStorage('my_entity')->create($values);