Skip to content

normalizeBedrockCatalog throws TypeError on non-array summaries or non-string model fields #1795

Description

@hsusul

Describe the bug

In src/helpers/bedrockCatalog.js:

  1. profileIdByModelId(inferenceProfileSummaries) and normalizeBedrockCatalog(modelSummaries, inferenceProfileSummaries) iterate directly over inferenceProfileSummaries || [] and modelSummaries || []. When passed non-array objects or primitives, it throws TypeError: (intermediate value) is not iterable.
  2. When sorting models via models.sort((a, b) => a.vendor.localeCompare(b.vendor) || a.label.localeCompare(b.label)), if a model summary contains non-string providerName, modelName, or modelId, calling .localeCompare() throws TypeError: a.vendor.localeCompare is not a function.

To Reproduce

  1. Call normalizeBedrockCatalog({}, {}) -> throws TypeError.
  2. Call normalizeBedrockCatalog(null, undefined) with non-string fields -> throws TypeError.

Expected Behavior

  • normalizeBedrockCatalog and profileIdByModelId should safely accept non-array inputs, defaulting to empty arrays.
  • vendor and label should safely be coerced to strings to ensure deterministic sorting without throwing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions