instructure/canvas-lms · error · ImportError
A # user did not pass validation (user: # , # : # , error…
Error message
A #{is_tags ? "differentiation tag" : "group"} user did not pass validation (user: #{user_id}, #{is_tags ? "differentiation tag" : "group"}: #{group_id}, error: #{group_membership.errors.full_messages.join(", ")}) What it means
If the GroupMembership record fails ActiveRecord validation on save, the importer raises an ImportError that embeds the user id, group id, and the model's full error messages, so the SIS row author knows exactly why the membership was rejected.
Solutions
- Read the embedded error message (after 'error: ') to see the exact validation failure and fix the data accordingly
- Check the group's member limits and remove duplicate membership rows in the batch
- Ensure the group and user are both active and compatible (same course/account context)
- Re-run the import after correcting the offending row
Example fix
# before duplicate rows: u_100,g_456,accepted twice in one batch # after single membership row per user/group pair in the batch
Defensive patterns
Strategy: try-catch
Validate before calling
gm = group.group_memberships.build(user: user)
unless gm.valid?
raise "would fail validation: #{gm.errors.full_messages.join(', ')}"
end Try / catch
begin
importer.add_group_membership(uid, gid, status)
rescue SIS::GroupImporter::ImportError => e
raise unless e.message.include?('did not pass validation')
Rails.logger.error("Membership rejected: #{e.message}")
# inspect error detail after 'error: ' and fix the offending row
end Prevention
- Deduplicate user/group pairs within a batch before import
- Check group member limits before bulk additions
- Ensure both user and group are active and share a valid context
- Dry-run problematic rows in console with GroupMembership#valid? before batch import
When it happens
Trigger: add_group_membership builds/saves a group_membership whose validations fail — e.g. duplicate active membership in a limited-membership group, invalid user/group association, model-level constraint violations surfaced by errors.full_messages.
Common situations: Group at membership capacity; attempting to add the same user twice within one batch; user/group in inconsistent states (deleted group); concurrent imports conflicting on the same membership.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- A course did not pass validation
- A # did not pass validation (# : # , error: # )
- An institutional tag category did not pass validation
- A (templated) course did not pass validation
- account.errors.first.message
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/f6edfd3247c23bd4.
Report an issue: GitHub.
Appendix: source
Thrown at lib/sis/group_membership_importer.rb:92
group_membership.sis_batch_id = @batch.id
case status
when /accepted/i
group_membership.workflow_state = "accepted"
when /deleted/i
group_membership.workflow_state = "deleted"
end
if group_membership.valid?
group_membership.save
data = SisBatchRollBackData.build_data(sis_batch: @batch, context: group_membership)
@roll_back_data << data if data
else
msg = "A #{is_tags ? "differentiation tag" : "group"} user did not pass validation "
msg += "(" + "user: #{user_id}, #{is_tags ? "differentiation tag" : "group"}: #{group_id}, error: "
msg += group_membership.errors.full_messages.join(", ") + ")"
raise ImportError, msg
end
@success_count += 1
end
end
end
end
View on GitHub (pinned to 1c9f0bb801)