{"record":{"id":"cc945b7962e2e892","repo":"instructure/canvas-lms","slug":"eventtype-event-type-is-invalid","errorCode":null,"errorMessage":"EventType #{event_type} is invalid","messagePattern":"EventType #(.+?) is invalid","errorType":"exception","errorClass":"Lti::SubscriptionsValidator::MissingCapability","httpStatus":400,"severity":"error","filePath":"app/controllers/lti/subscriptions_validator.rb","lineNumber":51,"sourceCode":"\n    CONTEXT_WHITELIST = {\n      \"root_account\" => Account,\n      \"assignment\" => Assignment\n    }.freeze\n\n    attr_reader :subscription, :tool_proxy\n\n    def initialize(subscription, tool_proxy)\n      @subscription = subscription.with_indifferent_access\n      @tool_proxy = tool_proxy\n    end\n\n    def check_required_capabilities!\n      capabilities_hash = ToolConsumerProfile.webhook_subscription_capabilities\n      return if tool_proxy.enabled_capabilities.include?(ToolConsumerProfile.webhook_grant_all_capability)\n\n      subscription[:EventTypes].each do |event_type|\n        raise MissingCapability, \"EventType #{event_type} is invalid\" unless capabilities_hash.key?(event_type.to_sym)\n        unless tool_proxy.enabled_capabilities.intersect?(capabilities_hash[event_type.to_sym])\n          raise MissingCapability, \"Missing required capability\"\n        end\n      end\n    end\n\n    def check_tool_context!\n      requested_context = subscription_context\n      requested_context = requested_context.course if requested_context.respond_to?(:course)\n      raise ToolNotInContext, \"Tool does not have access to requested context\" unless tool_proxy.active_in_context?(requested_context)\n    end\n\n    def validate_subscription_request!\n      check_required_capabilities!\n      check_tool_context!\n    end\n\n    def self.validate_subscription_context!(subscription)","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/controllers/lti/subscriptions_validator.rb#L33-L69","documentation":"Raised by Lti::SubscriptionsValidator#check_required_capabilities! when a requested LiveEvents subscription EventTypes entry is not a key in ToolConsumerProfile.webhook_subscription_capabilities — i.e. the event type is not a recognized/valid webhook subscription event. Canvas validates each subscription event type against the Tool Consumer Profile before creating it.","triggerScenarios":"POSTing to the LTI 2.x subscription API (via validate_subscription_request!) with subscription[:EventTypes] containing an event type string that does not exist in the tool consumer profile's capabilities hash.","commonSituations":"Typos in event type names (wrong casing, singular vs plural); requesting events introduced in a newer Canvas version than the one deployed; tools copying stale event lists from old documentation.","solutions":["Correct the EventTypes entry to a valid event name from the ToolConsumerProfile webhook subscription capabilities","Fetch the tool consumer profile to enumerate supported event types before subscribing","Upgrade Canvas if the event exists only in a newer release","Remove the unsupported event type from the subscription"],"exampleFix":"// before\n{ subscription: { EventTypes: ['submission_created'] } }\n// after\n{ subscription: { EventTypes: ['submission_created'] } } # verify name against ToolConsumerProfile.webhook_subscription_capabilities keys","handlingStrategy":"validation","validationCode":"valid_events = ToolConsumerProfile.webhook_subscription_capabilities.keys.map(&:to_s)\nbad = event_types - valid_events\nraise \"invalid event types: #{bad.join(',')}\" if bad.any?","typeGuard":null,"tryCatchPattern":"begin\n  validator.validate_subscription_request!\nrescue Lti::SubscriptionsValidator::MissingCapability => e\n  render json: { error: e.message, supported: ToolConsumerProfile.webhook_subscription_capabilities.keys }, status: :bad_request\nend","preventionTips":["Fetch the Tool Consumer Profile to enumerate event names","Copy event names from current Canvas docs, not old notes","Add an integration test validating each EventTypes entry"],"tags":["lti","live-events","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"1c9f0bb8013ed69c4f2efe11fd483025469b7e6c","analyzedAt":"2026-09-15T20:33:18.891Z","contentChangedAt":"2026-09-15T20:33:18.891Z","schemaVersion":2},"datasetVersion":"2026-09-23T02:17:17.105Z"}