{"record":{"id":"e5265c9f572a21d7","repo":"instructure/canvas-lms","slug":"requested-resourcelink-has-an-unexpected-content-type","errorCode":null,"errorMessage":"Requested ResourceLink has an unexpected content type","messagePattern":"Requested ResourceLink has an unexpected content type","errorType":"exception","errorClass":"Lti::IMS::AdvantageErrors::InvalidResourceLinkIdFilter","httpStatus":404,"severity":"error","filePath":"app/controllers/lti/ims/providers/memberships_provider.rb","lineNumber":178,"sourceCode":"    end\n\n    def assignment?\n      assignment&.present?\n    end\n\n    def validate_tool!\n      raise Lti::IMS::AdvantageErrors::InvalidResourceLinkIdFilter unless resource_link\n\n      if assignment? && !assignment.external_tool?\n        raise Lti::IMS::AdvantageErrors::InvalidResourceLinkIdFilter.new(\n          \"Assignment (id: #{assignment&.id}, rlid: #{rlid}) is not configured for submissions via external tool\",\n          api_message: \"Requested assignment not configured for external tool launches\"\n        )\n      end\n\n      tool_tag = assignment&.external_tool_tag || content_tag\n      if tool_tag.blank?\n        raise Lti::IMS::AdvantageErrors::InvalidResourceLinkIdFilter.new(\n          \"ContentTag (rlid: #{rlid}) not found\",\n          api_message: \"Requested ResourceLink was not found\"\n        )\n      end\n      if tool_tag.content_type != \"ContextExternalTool\"\n        raise Lti::IMS::AdvantageErrors::InvalidResourceLinkIdFilter.new(\n          \"ResourceLink (rlid: #{rlid}) needs content tag type 'ContextExternalTool' but found #{tool_tag.content_type}\",\n          api_message: \"Requested ResourceLink has an unexpected content type\"\n        )\n      end\n\n      unless tool.can_access_content_tag?(tool_tag)\n        raise Lti::IMS::AdvantageErrors::InvalidResourceLinkIdFilter.new(\n          \"ResourceLink (rlid: #{rlid}) needs binding to external tool #{tool.id} but found #{tool_tag.content_id}\",\n          api_message: \"Requested ResourceLink bound to unexpected external tool\"\n        )\n      end\n    end","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/controllers/lti/ims/providers/memberships_provider.rb#L160-L196","documentation":"Guard in MembershipsProvider#validate_tool!: the ContentTag attached to the rlid's resource link is neither an external-tool assignment tag nor a valid content tag for launches, i.e. the ResourceLink points at unexpected content, so the request is rejected with InvalidResourceLinkIdFilter.","triggerScenarios":"Thrown at app/controllers/lti/ims/providers/memberships_provider.rb:178 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Point the resource link/content tag at an external-tool item created via the LTI deep-linking flow","Re-create the link with the proper content type"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}