instructure/canvas-lms · error · ConversationsHelper::Error
Too many participants for group conversation
Error message
Too many participants for group conversation
What it means
process_response enforces group conversation size limits: conversation#can_add_participants?(recipients) must be true for the recipients being added. When the addition would exceed the allowed number of participants, ConversationsHelper::Error is raised with status :bad_request and attribute 'recipients'.
Solutions
- Split the recipients into smaller batches that stay within the conversation participant limit
- Check conversation#can_add_participants?(recipients) before calling and show the user a friendly limit error
- Increase the conversation participant limit setting if the policy allows
- Trim the recipient list (e.g. use course sections or filters) instead of one giant add
Example fix
// before add_recipients(conversation, all_student_ids) // after recipients.take(max_participants) # or chunk and send separate conversations add_recipients(conversation, recipients) if conversation.can_add_participants?(recipients)
Defensive patterns
Strategy: validation
Validate before calling
return render json: { error: 'too many recipients' }, status: :bad_request unless conversation.conversation.can_add_participants?(recipients) Try / catch
begin
process_response(...)
rescue ConversationsHelper::Error => e
render json: { error: e.message }, status: :bad_request if e.message.include?('Too many participants')
end Prevention
- Cap recipient list size in the UI before submit
- Check can_add_participants? proactively
- Chunk large recipient sets into multiple conversations
When it happens
Trigger: Adding a batch of recipients to a group conversation that would push the participant count past the configured maximum (conversation batch size / max participants setting).
Common situations: Bulk 'message all students' flows with very large enrollments; an admin lowering the max-participants setting below existing group sizes; copy/pasting a large recipient list into the composer.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- The following recipients have no active enrollment in the…
- Unable to create message without a body
- A course did not pass validation
- A # user did not pass validation (user: # , # : # , error…
- A maximum of 50 assessees can be provided at once
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/75b27f13a8d2fba1.
Report an issue: GitHub.
Appendix: source
Thrown at app/helpers/conversations_helper.rb:57
if context.is_a?(Course) && context.workflow_state == "completed" && !context.grants_right?(current_user, session, :read_as_admin)
raise ConversationsHelper::Error.new(message: I18n.t("Course concluded, unable to send messages"), status: :unauthorized, attribute: "workflow_state")
end
if body.blank?
raise ConversationsHelper::Error.new(message: I18n.t("Unable to create message without a body"), status: :bad_request, attribute: "empty_message")
end
recipients = normalize_recipients(
recipients:,
context_code:,
conversation_id: conversation.conversation_id,
current_user:,
session:
)
if recipients && !conversation.conversation.can_add_participants?(recipients)
raise ConversationsHelper::Error.new(message: I18n.t("Too many participants for group conversation"), status: :bad_request, attribute: "recipients")
end
invalid_recipients = get_invalid_recipients(context, recipients, current_user)
unless invalid_recipients.to_a.empty?
invalid_recipients = invalid_recipients.pluck(1)
raise ConversationsHelper::Error.new(message: I18n.t("The following recipients have no active enrollment in the course, %{invalid_recipients}, unable to send messages", invalid_recipients:), status: :unauthorized, attribute: "recipients")
end
tags = infer_tags(
recipients: conversation.conversation.participants.pluck(:id),
context_code:
)
validate_message_ids(message_ids, conversation, current_user:)
message_args = build_message_args(
body:,
attachment_ids:,
domain_root_account_id:,View on GitHub (pinned to 1c9f0bb801)