{"record":{"id":"98025edac5ef0749","repo":"instructure/canvas-lms","slug":"unable-to-find-a-submission-with-that-attempt","errorCode":null,"errorMessage":"Unable to find a submission with that attempt","messagePattern":"Unable to find a submission with that attempt","errorType":"exception","errorClass":"ActiveRecord::RecordNotFound","httpStatus":404,"severity":"error","filePath":"app/controllers/filters/quiz_submissions.rb","lineNumber":61,"sourceCode":"    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)\n    participant.access_code = params[:access_code]\n    participant.ip_address = request.remote_ip\n    participant.validation_token = params[:validation_token]\n\n    @service = Quizzes::QuizSubmissionService.new(participant)\n  end\nend\n","sourceCodeStart":43,"sourceCodeEnd":74,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/controllers/filters/quiz_submissions.rb#L43-L74","documentation":"Guard in Filters::QuizSubmissions#retrieve_quiz_submission_attempt!: model_for_attempt(attempt) returned nil, i.e. the quiz submission has no version/versioned model corresponding to the requested attempt number. Raised when fetching a quiz submission for a specific attempt that doesn't exist.","triggerScenarios":"Thrown at app/controllers/filters/quiz_submissions.rb:61 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use an attempt number between 1 and the submission's actual attempt count","Fetch the submission's attempt list first instead of hard-coding an attempt value"],"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"}