Found the issue.
It was a problem with my CustomPathGenerator class for the media package, namely on the getPath function:
public function getPath(Media $media) : string
{
if ($media->model_type === 'agent') {
return 'cms/agentes/' . Agent::find($media->model_id)->slug .'/';
}elseif ($media->model_type === 'store') {
return 'cms/lojas/' . $media->model_id .'/';
}
return $media->getKey();
}