{"record":{"id":"3b5facf854a4ab01","repo":"instructure/canvas-lms","slug":"quiz-submission-not-found","errorCode":null,"errorMessage":"Quiz Submission not found","messagePattern":"Quiz Submission not found","errorType":"exception","errorClass":"ActiveRecord::RecordNotFound","httpStatus":404,"severity":"error","filePath":"app/controllers/filters/quiz_submissions.rb","lineNumber":48,"sourceCode":"    scope = @quiz ? @quiz.quiz_submissions : Quizzes::QuizSubmission\n    id = if params.key?(:quiz_submission_id)\n           params[:quiz_submission_id]\n         else\n           params[:id]\n         end\n\n    if active\n      scope = scope.not_settings_only\n    end\n\n    if id.to_s == \"self\"\n      query[:user_id] = @current_user\n    else\n      query[:id] = id.to_i\n    end\n\n    unless (@quiz_submission = scope.where(query).first)\n      raise ActiveRecord::RecordNotFound, \"Quiz Submission not found\"\n    end\n\n    @quiz_submission.ensure_question_reference_integrity!\n    @quiz_submission\n  end\n\n  def require_active_quiz_submission\n    require_quiz_submission(active: true)\n  end\n\n  def retrieve_quiz_submission_attempt!(attempt)\n    unless (@quiz_submission = @quiz_submission.model_for_attempt(attempt.to_i))\n      raise ActiveRecord::RecordNotFound, \"Unable to find a submission with that attempt\"\n    end\n  end\n\n  def prepare_service\n    participant = Quizzes::QuizParticipant.new(@current_user, temporary_user_code)","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/controllers/filters/quiz_submissions.rb#L30-L66","documentation":"Guard in Filters::QuizSubmissions#require_quiz_submission: no Quizzes::QuizSubmission matches the id (or 'self' → current user) in the quiz/course scope. Raised for any route requiring a quiz submission; 'not_settings_only' also excludes settings-only submissions.","triggerScenarios":"Thrown at app/controllers/filters/quiz_submissions.rb:48 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the quiz_submission_id/id param and that the submission belongs to the requested quiz and user","Ensure the user actually took the quiz (a submission exists) before calling quiz-submission endpoints"],"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"}