instructure/canvas-lms · error · CedarUnavailable

Cedar unavailable

Error message

Cedar unavailable

What it means

call_cedar rescues generic CedarClientError and re-raises it as CedarUnavailable. This means the Cedar LLM backend itself failed (transport error, 5xx, client misconfiguration) — the request was made but no usable response came back.

Solutions

  1. Read the logged 'Cedar error for study_assist tool=...' line to get the underlying CedarClientError message.
  2. Retry after a short delay if it was a transient outage; the log line distinguishes transient vs config errors.
  3. Verify Cedar endpoint/credentials configuration for the environment.
  4. Confirm the study-assist feature slugs are provisioned/enabled for the account.

Example fix

// before
# treating CedarUnavailable like a user-input problem

// after
begin
  result = study_assist.call
rescue StudyAssist::CedarUnavailable => e
  Rails.logger.error("cedar_down=#{e.message}")
  render json: { error: 'Study Assist is temporarily unavailable' }, status: :service_unavailable
end
Defensive patterns

Strategy: try-catch

Validate before calling

# health-check Cedar before invoking, if a health endpoint exists
# cedar_healthy = CedarClient.healthcheck.ok?

Try / catch

begin
  result = study_assist.call
rescue StudyAssist::CedarUnavailable => e
  Rails.logger.error("cedar_unavailable=#{e.message}")
  render json: { error: 'study_assist_unavailable' }, status: :service_unavailable
end

Prevention

When it happens

Trigger: call -> call_cedar when CedarClient raises CedarClientError for any tool_key: network failure to Cedar, Cedar returning an HTTP error, or missing/invalid Cedar configuration for the study-assist feature slug.

Common situations: Cedar service outage or partial degradation; environment misconfiguration (wrong Cedar endpoint/credentials); feature slug 'study-assist-<tool>' not provisioned; timeouts under load.

Related errors


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

Appendix: source

Thrown at app/services/study_assist.rb:254

      end

      InstStatsd::Statsd.timing(
        "study_assist.cedar_call_duration",
        time.real,
        tags: { tool: tool_key.to_s }
      )

      response.response
    rescue InstructureMiscPlugin::Extensions::CedarClient::CedarLimitReachedError => e
      Rails.logger.warn("Cedar rate limit exceeded for #{tool_key}: #{e.message}")
      raise RateLimited, e.message
    rescue InstructureMiscPlugin::Extensions::CedarClient::CedarClientError => e
      Rails.logger.error(
        "Cedar error for study_assist tool=#{tool_key} " \
        "feature_slug=study-assist-#{tool_key} " \
        "user_global_id=#{@user.global_id}: #{e.message}"
      )
      raise CedarUnavailable, e.message
    end

    # --- Per-tool prompt + response ---

    def prompt_for_cedar(tool_key, llm_config, content)
      substitutions = (tool_key == :summarize) ? { KIND: summarize_kind(content) } : {}
      prompt, = llm_config.generate_prompt_and_options(substitutions:)
      prompt
    end

    def summarize_kind(content)
      case content.kind
      when :page then "page"
      when :file then "file"
      else "material"
      end
    end

View on GitHub (pinned to 1c9f0bb801)