{"record":{"id":"e0999b830181bbda","repo":"instructure/canvas-lms","slug":"selecteddatefilter-must-be-one-of-valid-date-filters-join","errorCode":null,"errorMessage":"selectedDateFilter must be one of: #{VALID_DATE_FILTERS.join(\", \")}","messagePattern":"selectedDateFilter must be one of: #(.+?)","errorType":"validation","errorClass":"GraphQL::ExecutionError","httpStatus":null,"severity":"error","filePath":"app/graphql/mutations/update_widget_dashboard_config.rb","lineNumber":137,"sourceCode":"\n    invalid_keys = filters.keys - [\"filter\"]\n    unless invalid_keys.empty?\n      raise GraphQL::ExecutionError, \"invalid filter keys for todo list widget: #{invalid_keys.join(\", \")}\"\n    end\n  end\n\n  def validate_course_work_filters!(filters)\n    if filters.key?(\"selectedCourse\")\n      course_value = filters[\"selectedCourse\"]\n      unless course_value.is_a?(String) && (course_value == \"all\" || course_value.match?(/^course_\\d+$/))\n        raise GraphQL::ExecutionError, \"selectedCourse must be 'all' or 'course_{id}'\"\n      end\n    end\n\n    if filters.key?(\"selectedDateFilter\")\n      date_filter = filters[\"selectedDateFilter\"]\n      unless date_filter.is_a?(String) && VALID_DATE_FILTERS.include?(date_filter)\n        raise GraphQL::ExecutionError, \"selectedDateFilter must be one of: #{VALID_DATE_FILTERS.join(\", \")}\"\n      end\n    end\n\n    invalid_keys = filters.keys - [\"selectedCourse\", \"selectedDateFilter\"]\n    unless invalid_keys.empty?\n      raise GraphQL::ExecutionError, \"invalid filter keys for course work widget: #{invalid_keys.join(\", \")}\"\n    end\n  end\n\n  def validate_generic_filters!(filters)\n    filters.each_value do |value|\n      validate_filter_value!(value)\n    end\n  end\n\n  def validate_filter_value!(value)\n    return if value.nil?\n","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/graphql/mutations/update_widget_dashboard_config.rb#L119-L155","documentation":"The course work widget's \"selectedDateFilter\" must be a String in VALID_DATE_FILTERS (\"not_submitted\", \"missing\", \"submitted\"). validate_course_work_filters! raises this GraphQL::ExecutionError for any other value or non-string type.","triggerScenarios":"Sending filters[\"selectedDateFilter\"] = \"late\", \"all\", \"NOT_SUBMITTED\", an array, or null for the course work widget.","commonSituations":"Client enum drifted from the server allowlist; using date-range strings (e.g. \"last_week\") that this widget does not support; case sensitivity.","solutions":["Use exactly one of \"not_submitted\", \"missing\", or \"submitted\"","Check VALID_DATE_FILTERS in app/graphql/mutations/update_widget_dashboard_config.rb for the current allowed list","Sync the client-side filter enum with the server constant"],"exampleFix":"// before\nfilters: { \"selectedDateFilter\": \"late\" }\n// after\nfilters: { \"selectedDateFilter\": \"missing\" }","handlingStrategy":"validation","validationCode":"const VALID = [\"not_submitted\", \"missing\", \"submitted\"];\nif (filters.selectedDateFilter !== undefined && !(typeof filters.selectedDateFilter === \"string\" && VALID.includes(filters.selectedDateFilter))) {\n  throw new Error(`selectedDateFilter must be one of: ${VALID.join(\", \")}`);\n}","typeGuard":"const isDateFilter = (v) => typeof v === \"string\" && [\"not_submitted\",\"missing\",\"submitted\"].includes(v);","tryCatchPattern":null,"preventionTips":["Sync the client date-filter enum with VALID_DATE_FILTERS","Use lowercase snake_case values exactly as defined","Add a runtime assertion when filters are built from URL params"],"tags":["graphql","validation","invalid-enum-value"],"backgroundTag":"invalid-enum-value","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"}