{"record":{"id":"f8165e7dcd1552f1","repo":"instructure/canvas-lms","slug":"the-field-field-must-have-no-spaces","errorCode":null,"errorMessage":"The \"%{field}\" field must have no spaces","messagePattern":"The \"%(.+?)\" field must have no spaces","errorType":"validation","errorClass":"InvalidDataError","httpStatus":null,"severity":"error","filePath":"lib/outcomes/import.rb","lineNumber":39,"sourceCode":"  module Import\n    class InvalidDataError < RuntimeError; end\n\n    class DataFormatError < RuntimeError; end\n\n    GROUP_ONLY_FIELDS = %i[course_id].freeze\n    OBJECT_ONLY_FIELDS = %i[calculation_method calculation_int ratings].freeze\n    VALID_WORKFLOWS = [nil, \"\", \"active\", \"deleted\"].freeze\n\n    def check_object(object)\n      %i[vendor_guid title].each do |field|\n        next if object[field].present?\n\n        raise InvalidDataError, I18n.t(\n          'The \"%{field}\" field is required', field:\n        )\n      end\n      if object[:vendor_guid].match?(/\\s/)\n        raise InvalidDataError, I18n.t(\n          'The \"%{field}\" field must have no spaces',\n          field: \"vendor_guid\"\n        )\n      end\n      unless VALID_WORKFLOWS.include? object[:workflow_state]\n        raise InvalidDataError, I18n.t(\n          '\"%{field}\" must be either \"%{active}\" or \"%{deleted}\"',\n          field: \"workflow_state\",\n          active: \"active\",\n          deleted: \"deleted\"\n        )\n      end\n    end\n\n    def import_object(object)\n      check_object(object)\n\n      type = object[:object_type]","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/lib/outcomes/import.rb#L21-L57","documentation":"Raised by Outcomes::Import#check_object when the vendor_guid value contains whitespace characters (matched by /\\s/). vendor_guid is an external identifier used for lookups and deduplication, so spaces (leading, trailing, or internal) are rejected with an InvalidDataError. The error message names the field as vendor_guid explicitly.","triggerScenarios":"vendor_guid like 'ABC 123' with an internal space; cells pasted with trailing whitespace or non-breaking spaces from Excel/Word; IDs copied with a trailing tab.","commonSituations":"Copy-pasted identifiers containing non-breaking spaces (U+00A0), which \\s matches; spreadsheet autoformatting adding spaces; source systems allowing spaces in their external IDs.","solutions":["Remove all whitespace from the vendor_guid value (use a hyphen or underscore instead of spaces).","Trim and clean the column: gsub(/\\s+/, '') or a targeted strip, replacing internal spaces with '_'.","Check for invisible whitespace such as non-breaking spaces before re-importing."],"exampleFix":"// before\nvendor_guid: \"CCSS ELA-Literacy RST.1\"\n// after\nvendor_guid: \"CCSS_ELA-Literacy_RST.1\"","handlingStrategy":"validation","validationCode":"guid = row['vendor_guid'].to_s\nraise \"vendor_guid has whitespace\" if guid.match?(/\\s/)","typeGuard":null,"tryCatchPattern":"begin\n  importer.run\nrescue Outcomes::Import::InvalidDataError => e\n  collect_error(e.message) # 'The \"vendor_guid\" field must have no spaces'\nend","preventionTips":["Normalize vendor_guid with gsub(/\\s+/, '_') in preprocessing","Watch for non-breaking spaces (U+00A0) from copy-paste","Restrict vendor_guid to a safe charset like [A-Za-z0-9_.-] at entry time"],"tags":["csv","identifier","validation","outcomes"],"backgroundTag":"invalid-identifier-format","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"}