instructure/canvas-lms · error · GraphQL::ExecutionError

An unexpected error occurred while submitting feedback.

Error message

An unexpected error occurred while submitting feedback.

What it means

BaseAiFeedback subclasses (AI feedback submissions mutations) wrap resolve in a catch-all rescue. Any exception other than GraphQL::ExecutionError raised while submitting AI feedback is logged as '[ClassName ERROR]' and re-raised as a generic 'An unexpected error occurred while submitting feedback.' ExecutionError. It masks the true cause from API clients by design.

Solutions

  1. Grep server logs for '[<MutationClassName> ERROR]' to find the real exception
  2. Verify the AI feedback feature flag and backend service are correctly configured on the root account
  3. Retry after confirming the response/result object is non-nil before use
  4. Rescue known failure modes explicitly in the subclass and raise a descriptive GraphQL::ExecutionError

Example fix

// before
rescue => e
  Rails.logger.error("[#{self.class.name} ERROR] #{e.message}")
  raise GraphQL::ExecutionError, I18n.t("An unexpected error occurred while submitting feedback.")
// after
rescue AiFeedback::BackendError => e
  raise GraphQL::ExecutionError, I18n.t("AI feedback service unavailable: %{msg}", msg: e.message)
Defensive patterns

Strategy: try-catch

Validate before calling

// verify feature availability before submitting feedback
const flags = await canvas.get('/api/v1/accounts/self/features')
if (!flags.includes('ai_feedback')) throw new Error('AI feedback not enabled')

Type guard

function hasResponseId(r) { return r != null && typeof r.response_id === 'string' && r.response_id.length > 0 }

Try / catch

try {
  const res = await client.mutate({ mutation: SUBMIT_AI_FEEDBACK, variables })
  return res.data
} catch (e) {
  if (e.graphQLErrors?.some(g => g.message.includes('unexpected error occurred while submitting feedback'))) {
    // correlate with '[ClassName ERROR]' server log entry
  }
  throw e
}

Prevention

When it happens

Trigger: Any mutation inheriting app/graphql/mutations/base_ai_feedback.rb (e.g. createAiFeedback) whose resolve raises: backend AI call failure, missing root_account_uuid, nil result, or validation errors not wrapped as ExecutionError.

Common situations: AI feedback feature flag enabled but backend endpoint misconfigured; response object nil because the AI service returned empty; subclass failing its own permission/flag checks with a plain RuntimeError.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15). Data as JSON: /api/errors/ca2c631741a17f58. Report an issue: GitHub.

Appendix: source

Thrown at app/graphql/mutations/base_ai_feedback.rb:49

  def resolve(input:)
    root_account_uuid = check_feature_and_permissions!(input)

    result = CedarClient.submit_feedback(
      response_id: input[:response_id],
      feedback_type: input[:feedback_type],
      feature_slug:,
      root_account_uuid:,
      current_user:,
      comment: input[:comment]
    )

    { response_id: result.response_id }
  rescue GraphQL::ExecutionError => e
    Rails.logger.error("[#{self.class.name} GraphQL ExecutionError] #{e.message}")
    raise e
  rescue => e
    Rails.logger.error("[#{self.class.name} ERROR] #{e.message}")
    raise GraphQL::ExecutionError, I18n.t("An unexpected error occurred while submitting feedback.")
  end

  private

  # Subclasses must perform feature flag and permission checks here,
  # then return the root_account_uuid string.
  def check_feature_and_permissions!(_input)
    raise NotImplementedError, "#{self.class} must implement check_feature_and_permissions!"
  end

  # Subclasses must return the Cedar feature slug string.
  def feature_slug
    raise NotImplementedError, "#{self.class} must implement feature_slug"
  end
end

View on GitHub (pinned to 1c9f0bb801)