{"record":{"id":"defe444d6370e8c3","repo":"instructure/canvas-lms","slug":"no-such-outcome-for-id-id","errorCode":null,"errorMessage":"No such outcome for id %{id}","messagePattern":"No such outcome for id %(.+?)","errorType":"exception","errorClass":"GraphQL::ExecutionError","httpStatus":null,"severity":"error","filePath":"app/graphql/mutations/set_friendly_description.rb","lineNumber":105,"sourceCode":"    unless VALID_CONTEXTS.include?(context_type)\n      raise GraphQL::ExecutionError, I18n.t(\"Invalid context type\")\n    end\n\n    context_type.constantize.find_by(id: context_id).tap do |context|\n      unless context\n        raise GraphQL::ExecutionError, I18n.t(\n          \"No such context for %{context_type}#%{context_id}\",\n          context_type:,\n          context_id: context_id.to_s\n        )\n      end\n    end\n  end\n\n  def get_outcome(outcome_id)\n    LearningOutcome.active.find_by(id: outcome_id).tap do |outcome|\n      unless outcome\n        raise GraphQL::ExecutionError, I18n.t(\n          \"No such outcome for id %{id}\", { id: outcome_id }\n        )\n      end\n    end\n  end\nend\n","sourceCodeStart":87,"sourceCodeEnd":112,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/graphql/mutations/set_friendly_description.rb#L87-L112","documentation":"SetFriendlyDescription mutation raises this when the given outcome_id does not match any ACTIVE LearningOutcome in the database. find_by returns nil for a missing or soft-deleted (workflow_state != active) outcome, and get_outcome converts that nil into a GraphQL::ExecutionError before resolve continues.","triggerScenarios":"Calling setFriendlyDescription with an outcome id that never existed, an id belonging to a deleted outcome, or an id from a different Rails shard/root account.","commonSituations":"Stale outcome id cached in an older UI page or LTI payload; outcome was deleted by an admin after the page loaded; multi-shard setups where the id is looked up on the wrong shard.","solutions":["Verify the outcome id exists and is active: LearningOutcome.active.where(id: id).exists?","If the outcome was deleted, pick a valid outcome id from assignment.learning_outcome_id or the course outcome list","In multi-shard environments, ensure the id is resolved on the outcome's shard"],"exampleFix":"// before\noutcome = LearningOutcome.active.find_by(id: outcome_id)\nraise GraphQL::ExecutionError, \"No such outcome\" unless outcome\n// after\nif LearningOutcome.active.where(id: outcome_id).exists?\n  SetFriendlyDescription.resolve(outcome_id: outcome_id)\nelse\n  Rails.logger.warn(\"skipping friendly description: outcome #{outcome_id} missing/inactive\")\nend","handlingStrategy":"validation","validationCode":"// Ruby\ndef outcome_usable?(outcome_id)\n  LearningOutcome.active.where(id: outcome_id).exists?\nend","typeGuard":"// Ruby\noutcome = LearningOutcome.active.find_by(id: outcome_id)\nreturn unless outcome.is_a?(LearningOutcome)","tryCatchPattern":null,"preventionTips":["Resolve outcome ids from the course/assignment relationship, not stored client state","Remember find_by filters soft-deleted outcomes — check workflow_state is 'active'","On multi-shard installs, resolve ids on the owning shard"],"tags":["graphql","ruby","learning-outcomes","record-not-found"],"backgroundTag":"entity-not-found","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"}