{"record":{"id":"bdfe2701cafdc7b2","repo":"instructure/canvas-lms","slug":"quiz-not-found","errorCode":null,"errorMessage":"Quiz not found","messagePattern":"Quiz not found","errorType":"exception","errorClass":"ActiveRecord::RecordNotFound","httpStatus":404,"severity":"error","filePath":"app/controllers/filters/quizzes.rb","lineNumber":28,"sourceCode":"# Software Foundation, version 3 of the License.\n#\n# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY\n# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more\n# details.\n#\n# You should have received a copy of the GNU Affero General Public License along\n# with this program. If not, see <http://www.gnu.org/licenses/>.\n#\n\nmodule Filters::Quizzes\n  protected\n\n  def require_quiz\n    id = params.key?(:quiz_id) ? params[:quiz_id] : params[:id]\n\n    unless (@quiz = @context.quizzes.find(id))\n      raise ActiveRecord::RecordNotFound, \"Quiz not found\"\n    end\n\n    @quiz\n  end\n\n  def require_course\n    @course = api_find(Course.active, params[:course_id])\n    params[:context_id] = params[:course_id]\n    params[:context_type] = \"Course\"\n    authorized_action(@course, @current_user, :read)\n  end\nend\n","sourceCodeStart":10,"sourceCodeEnd":41,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/controllers/filters/quizzes.rb#L10-L41","documentation":"Generic not-found guard in Filters::Quizzes#require_quiz: no quiz exists in @context matching params[:quiz_id] (or params[:id]). This sentinel ActiveRecord::RecordNotFound is raised for every quizzes API/controller route needing a quiz.","triggerScenarios":"Thrown at app/controllers/filters/quizzes.rb:28 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the quiz_id/id references an existing, non-deleted quiz in the given course","Check for typo'd or stale quiz ids from the client"],"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"}