{"record":{"id":"b84c21a89bd12a19","repo":"instructure/canvas-lms","slug":"group-not-found-import-outcomes","errorCode":null,"errorMessage":"group not found","messagePattern":"group not found","errorType":"exception","errorClass":"GraphQL::ExecutionError","httpStatus":null,"severity":"error","filePath":"app/graphql/mutations/import_outcomes.rb","lineNumber":73,"sourceCode":"          attribute: \"sourceContextId\"\n        )\n      end\n    elsif input[:source_context_id].present?\n      return validation_error(\n        I18n.t(\"sourceContextType required if sourceContextId provided\"),\n        attribute: \"sourceContextType\"\n      )\n    end\n\n    target_context, target_group = get_target(input)\n\n    verify_authorized_action!(target_context, :manage_outcomes)\n\n    if (group_id = input[:group_id].presence)\n      # Import the entire group into the given context\n      group = LearningOutcomeGroup.active.find_by(id: group_id)\n      if group.nil?\n        raise GraphQL::ExecutionError, I18n.t(\"group not found\")\n      end\n\n      # If optional source context provided, then check that\n      # matches the group's context\n      source_context ||= group.context\n      if source_context && source_context != group.context\n        raise GraphQL::ExecutionError, I18n.t(\"source context does not match group context\")\n      end\n\n      # source has to be global or in an associated account\n      unless !source_context || target_context.associated_accounts.include?(source_context)\n        raise GraphQL::ExecutionError, I18n.t(\"invalid context for group\")\n      end\n\n      # source can't be a root group\n      if group.learning_outcome_group_id.nil?\n        raise GraphQL::ExecutionError, I18n.t(\"cannot import a root group\")\n      end","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/graphql/mutations/import_outcomes.rb#L55-L91","documentation":"ImportOutcomes raises this when a groupId was supplied but no active LearningOutcomeGroup with that id exists. The lookup is LearningOutcomeGroup.active.find_by(id: group_id), so soft-deleted (workflow_state != 'active') groups also produce this error.","triggerScenarios":"Calling importOutcomes with groupId of a deleted or inactive outcome group, an id from a different account/shard, a typo'd id, or passing a ContentTag/outcome id instead of a group id.","commonSituations":"Group was deleted by a user between fetching the list and importing; using ids from an unrelated root account; stale UI caches pointing at removed groups; confusing outcome ids with group ids in the payload.","solutions":["Verify the group exists and is active: LearningOutcomeGroup.active.find_by(id:) in rails console","Re-list outcome groups via GraphQL (learningOutcomeGroups or context outcomes query) and use a fresh id","Check root account/shard scoping of the id","If the group was deleted, import its parent group or recreate/restore it first"],"exampleFix":"// before\nimportOutcomes(input: { groupId: \"404-group\", targetGroupId: \"5\" })\n// after: pick an active group id from a fresh query\nconst groups = await account.outcomesGroupsConnection; // active only\nimportOutcomes(input: { groupId: groups[0].id, targetGroupId: \"5\" });","handlingStrategy":"validation","validationCode":"const g = await graphqlClient.node(toGlobalId(\"LearningOutcomeGroup\", groupId));\nif (!g || g.workflowState !== \"active\") throw new Error(\"group not found or inactive\");","typeGuard":null,"tryCatchPattern":"try {\n  await importOutcomes({ groupId, ...target });\n} catch (e) {\n  if (e.message === \"group not found\") {\n    // re-fetch the group list and let the user pick a new source group\n  }\n}","preventionTips":["Re-query active outcome groups right before import; never cache group ids long-term","Do not confuse outcome ids with group ids","Filter client-side group lists to workflowState active","Verify ids belong to the same root account/shard"],"tags":["graphql","resource-not-found","outcomes","canvas-lms"],"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"}