Skip to content

Fix crash on invalid agent cards without supported_interfaces #2

@a6b8

Description

@a6b8

Problem

When an A2A agent card is fetched successfully (HTTP 200, valid JSON) but is missing supported_interfaces, SnapshotBuilder.build() crashes on .map() of undefined. This causes the entire validation promise to reject instead of returning structured error messages.

Root Cause

  • CapabilityClassifier.classify() calls supportedInterfaces.map() without null-check
  • SnapshotBuilder.build() calls supportedInterfaces.map() and skills.map() without null-checks
  • A2aAgentValidator.start() always calls classify/build even when CardStructureValidator reports structure errors

Fix

  1. Early-return in start() when structure validation fails — use buildEmpty() instead of build()
  2. Defensive Array.isArray() checks in SnapshotBuilder.build() for supported_interfaces and skills
  3. Defensive Array.isArray() check in CapabilityClassifier.classify() for supported_interfaces

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