instructure/canvas-lms · error · MissingRequiredToolProfileValuesError

MissingRequiredToolProfileValuesError

MissingRequiredToolProfileValuesError

Error message

Missing required values: %{missing_values}

What it means

Importers::ToolProfileImporter.tease_out_required_values! extracts required LTI tool profile fields (e.g. product_name default_value) from imported JSON. If any required value is nil it raises MissingRequiredToolProfileValuesError listing the missing keys, via an I18n message interpolating %{missing_values}.

Solutions

  1. Fix the source JSON to include all required values.
  2. Validate the tool profile against the LTI ToolProfile schema before import.
  3. Use the error's listed keys to request corrected data from the vendor.
  4. Provide defaults only if product rules allow it.

Example fix

// before
{"tool_profile":{"product_instance":{"product_info":{}}}}
// after
{"tool_profile":{"product_instance":{"product_info":{"product_name":{"default_value":"My Tool"}}}}}
Defensive patterns

Strategy: validation

Validate before calling

required = %w[tool_profile.product_instance.product_info.product_name.default_value]
missing = required.select { |path| tool_profile.dig(*path.split(".")).nil? }
raise "missing: #{missing.join(",")}" if missing.any?

Try / catch

begin
  Importers::ToolProfileImporter.process_migration(migration, tool_profile)
rescue Importers::ToolProfileImporter::MissingRequiredToolProfileValuesError => e
  report_import_failure(migration, e.message)
end

Prevention

When it happens

Trigger: Importing a tool profile migration whose JSON lacks required paths, e.g. tool_profile.product_instance.product_info.product_name.default_value absent or null.

Common situations: Hand-written or vendor-supplied LTI ToolProfile JSON missing default_value fields; schema version drift where keys moved or were renamed; partial exports.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

Thrown at app/models/importers/tool_profile_importer.rb:65

        rescue MissingRequiredToolProfileValuesError => e
          migration.add_import_warning("tool_profile", tool_profile["resource_href"], e)
        end
      end

      private

      def tease_out_required_values!(tool_profile)
        values = {
          vendor_code: tool_profile.dig("tool_profile", "product_instance", "product_info", "product_family", "vendor", "code"),
          product_code: tool_profile.dig("tool_profile", "product_instance", "product_info", "product_family", "code"),
          registration_url: tool_profile.dig("meta", "registration_url"),
          product_name: tool_profile.dig("tool_profile", "product_instance", "product_info", "product_name", "default_value"),
        }

        missing_keys = values.select { |_, v| v.nil? }.keys

        if missing_keys.present?
          raise MissingRequiredToolProfileValuesError, I18n.t("Missing required values: %{missing_values}", missing_values: missing_keys.join(","))
        else
          values
        end
      end
    end
  end
end

View on GitHub (pinned to 1c9f0bb801)