instructure/canvas-lms · error
can't add participants to a private conversation
Error message
can't add participants to a private conversation
What it means
Guard in Conversation#add_participants: attempting to add participants to a private (two-person) conversation, which Canvas doesn't support — private conversations cannot grow. Raised when users are added to a conversation whose privacy type is 'private'.
Solutions
- Start a new group conversation that includes the original participants plus the new users instead of mutating the private one
- Check conversation.private? before calling add_participants and skip/handle private ones
- Convert workflows to use 'add to conversation' only for group conversations
Example fix
# before conversation.add_participants(user, new_users) # after unless conversation.private? conversation.add_participants(user, new_users) else Conversation.initiate([*conversation.participants.map(&:id), *new_users.map(&:id)], false) end
Defensive patterns
Strategy: validation
Validate before calling
raise 'cannot extend private conversation' if conversation.private?
Type guard
null
Try / catch
begin
conversation.add_participants(user, users)
rescue RuntimeError => e
raise e unless e.message.include?('private conversation')
# initiate a new group conversation including everyone
end Prevention
- Check private? before offering 'add people' UI
- Initiate a fresh group conversation when the thread is private
- Avoid blanket automation over mixed conversation types
When it happens
Trigger: Calling add_participants on a conversation with private? == true (created as a single-pair conversation) with a non-empty list of new users; bulk scripts iterating conversations without checking private?.
Common situations: UI or API attempting to add people to a 1:1 conversation; legacy conversations data with private_type set; automation that assumes all conversations are group conversations.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- can only forward one conversation at a time
- can't add participants if there are no messages
- Unauthorized, unable to add messages to conversation
- user doesn't have permission to forward these messages
- A new_id, '# ', referenced an existing # and the # with #…
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/00d417014e1effeb.
Report an issue: GitHub.
Appendix: source
Thrown at app/models/conversation.rb:172
end
conversation
end
end
# conversations with more recipients than this should force individual messages
def self.max_group_conversation_size
Setting.get("max_group_conversation_size", 100).to_i
end
def can_add_participants?(users)
(users.map(&:id) + conversation_participants.pluck(:user_id)).uniq.count <= self.class.max_group_conversation_size + 1
end
def add_participants(current_user, users, options = {})
message = nil
shard.activate do
user_ids = users.map(&:id).uniq
raise "can't add participants to a private conversation" if private?
transaction do
lock!
user_ids -= conversation_participants.map(&:user_id)
next if user_ids.empty?
if options[:no_messages]
bulk_insert_options = {
workflow_state: "unread",
message_count: 0,
private_hash:
}
else
last_message_at = conversation_messages.human.first.try(:created_at)
raise "can't add participants if there are no messages" unless last_message_at
num_messages = conversation_messages.human.size
View on GitHub (pinned to 1c9f0bb801)