{"record":{"id":"bb1bb732f1463652","repo":"instructure/canvas-lms","slug":"id-type-to-s-sub-id-titleize-with-sis-id-id-didn-t-exist-for","errorCode":null,"errorMessage":"#{id_type.to_s.sub(\"_id\", \"\").titleize} with sis id #{id} didn't exist for #{type_display_name(type)} #{item_id}.","messagePattern":"#(.+?) with sis id #(.+?) didn't exist for #(.+?) #(.+?)\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/sis/group_importer.rb","lineNumber":74,"sourceCode":"        return true if @batch.skip_deletes? && status =~ /deleted/i\n\n        false\n      end\n\n      def find_context(id, id_type, type, item_id)\n        context = nil\n        cache = (id_type == :course_id) ? @courses_cache : @accounts_cache\n\n        if id\n          context = cache[id]\n          context ||= if id_type == :course_id\n                        @root_account.all_courses.active.find_by(sis_source_id: id)\n                      else\n                        @root_account.all_accounts.active.find_by(sis_source_id: id)\n                      end\n\n          unless context\n            raise ImportError, \"#{id_type.to_s.sub(\"_id\", \"\").titleize} with sis id #{id} didn't exist for #{type_display_name(type)} #{item_id}.\"\n          end\n\n          cache[context.sis_source_id] = context if context\n        end\n\n        context\n      end\n\n      def find_category(category_id, context, category_type, item_type, item_id)\n        return nil unless category_id.present?\n\n        category_display_name = if category_type.to_s == \"differentiation_tag_category\"\n                                  \"Differentiation Tag Set\"\n                                else\n                                  \"Group Category\"\n                                end\n\n        category = nil","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/lib/sis/group_importer.rb#L56-L92","documentation":"Raised by find_context when the course_id or account_id supplied for a row does not resolve to an existing active Course or Account under the root account by sis_source_id. The importer cannot attach the item to a nonexistent context, so it fails the row naming the context type, sis id, and item id.","triggerScenarios":"add_group called with an account_id or course_id whose sis_source_id matches no active account/course in the root account, including deleted/concluded courses.","commonSituations":"Course sis ids changed or courses deleted between exports; ids from a different root account/shard; typos in sis_source_id; groups.csv imported before courses.csv.","solutions":["Correct the course_id/account_id sis_source_id to an existing active record.","Ensure the referenced context was imported first (courses.csv/accounts.csv in the same batch).","Verify the course is active, not deleted or concluded.","Confirm the sis id belongs to the same root account as the batch."],"exampleFix":"# before\ngroup_id,course_id,name,status\nG101,C9999,Study Group A,available   # C9999 not found\n# after\ngroup_id,course_id,name,status\nG101,C200,Study Group A,available","handlingStrategy":"validation","validationCode":"ctx = root_account.all_courses.active.find_by(sis_source_id: course_id) ||\n      root_account.all_accounts.active.find_by(sis_source_id: account_id)\nraise ArgumentError, \"context #{course_id || account_id} not found\" unless ctx","typeGuard":null,"tryCatchPattern":"begin\n  importer.add_group(gid, cat_id, acct_id, course_id, name, status)\nrescue ImportError => e\n  logger.warn(\"Unresolved context: #{e.message}\")\nend","preventionTips":["Import courses.csv/accounts.csv before groups.csv in the same batch","Re-verify sis_source_ids after deletions or term rollovers","Keep context ids within the same root account/shard","Join exports against Canvas to drop stale course ids"],"tags":["sis-import","resource-not-found","ruby"],"backgroundTag":"resource-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"}