{"record":{"id":"5618dbeeaeb63d2a","repo":"instructure/canvas-lms","slug":"no-name-given-for-account-account-id-skipping","errorCode":null,"errorMessage":"No name given for account #{account_id}, skipping","messagePattern":"No name given for account #(.+?), skipping","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/sis/account_importer.rb","lineNumber":68,"sourceCode":"\n      def add_account(account_id, parent_account_id, status, name, integration_id)\n        raise ImportError, \"No account_id given for an account\" if account_id.blank?\n        return if @batch.skip_deletes? && status =~ /deleted/i\n\n        parent = nil\n        unless parent_account_id.blank?\n          parent = @accounts_cache[parent_account_id]\n          parent ||= @root_account.all_accounts.find_by(sis_source_id: parent_account_id)\n          raise ImportError, \"Parent account didn't exist for #{account_id}\" unless parent\n          raise ImportError, \"Cannot restore sub_account with ID: #{account_id} because parent_account with ID: #{parent_account_id} has been deleted.\" if parent.workflow_state == \"deleted\"\n\n          @accounts_cache[parent.sis_source_id] = parent\n        end\n\n        account = @accounts_cache[account_id]\n        account ||= @root_account.all_accounts.find_by(sis_source_id: account_id)\n        if account.nil?\n          raise ImportError, \"No name given for account #{account_id}, skipping\" if name.blank?\n          raise ImportError, \"Improper status \\\"#{status}\\\" for account #{account_id}, skipping\" unless /\\A(active|deleted)/i.match?(status)\n        end\n\n        account ||= @root_account.sub_accounts.new\n\n        account.root_account = @root_account\n        if account.new_record? || !account.stuck_sis_fields.include?(:parent_account_id) || Account.sis_stickiness_options[:add_sis_stickiness]\n          account.parent_account = parent || @root_account\n        end\n\n        # only update the name on new records, and ones that haven't been changed since the last sis import\n        account.name = name if name.present? && (account.new_record? || !account.stuck_sis_fields.include?(:name))\n\n        account.integration_id = integration_id if integration_id.present?\n        account.sis_source_id = account_id\n\n        if status.present?\n          case status","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/lib/sis/account_importer.rb#L50-L86","documentation":"When the account_id doesn't match an existing account (a brand-new sub-account will be created), the importer requires a non-blank name. If name is blank it raises ImportError. Existing accounts may be updated without a name, but new records cannot be created unnamed.","triggerScenarios":"add_account called where no account with the given sis_source_id exists under the root account AND name is nil/blank — typically an accounts.csv row with empty 'name' for a new account.","commonSituations":"SIS export omitting the name column for newly added accounts; CSV column misalignment shifting values; intentionally blank names for placeholder rows.","solutions":["Provide a name for the new account row in accounts.csv.","Check the account already exists in Canvas (then name is optional for the update path).","Verify CSV column headers/order so the name value lands in the right field."],"exampleFix":"// before\nadd_account('sub2', 'parent1', 'active', '', nil)\n// after\nadd_account('sub2', 'parent1', 'active', 'New Sub Account', nil)","handlingStrategy":"validation","validationCode":"if new_record_required && name.to_s.strip.empty?\n  raise ArgumentError, \"name required for new account #{account_id}\"\nend","typeGuard":null,"tryCatchPattern":"begin\n  importer.add_account(id, parent_id, status, name, integration_id)\nrescue SIS::BaseImporter::ImportError => e\n  logger.warn(\"#{e.message}\")\nend","preventionTips":["Require non-empty name cells in accounts.csv for new accounts","Check CSV column alignment after schema changes","Pre-load existing sis_source_ids to know which rows are creates vs updates"],"tags":["sis","validation","csv-import"],"backgroundTag":"empty-required-field","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"}