microsoft/aspire · error · InvalidOperationException

The Microsoft Foundry model catalog response included…

Error message

The Microsoft Foundry model catalog response included partial failure data in {string.Join(", ", partialFailureFields)}. Refusing to overwrite the generated model descriptors with a partial catalog. Response: {GetResponseSnippet(pageResponse)}

What it means

ValidateSuccessfulCatalogResponse is called by GetAllModelsAsync on each catalog page after the value array is extracted. If GetPartialFailureFields finds any partial-failure indicators in the deserialized ApiResponse, it throws with the offending field names and a response snippet, preventing a partially loaded catalog from overwriting the generated descriptors.

Solutions

  1. Re-run the tool — transient partial pages usually succeed on a later run.
  2. Compare the listed partial-failure fields against the current API schema; update GetPartialFailureFields if the meaning of fields changed.
  3. Check Foundry service health if partial data persists across runs.
  4. If a specific page is consistently partial, capture the snippet and report/investigate the specific index range it covers.
Defensive patterns

Strategy: retry

Try / catch

try
{
    await RunGenModelAsync();
}
catch (InvalidOperationException ex) when (ex.Message.Contains("included partial failure data in"))
{
    // page-level partial data: retry the run; inspect listed fields if persistent
}

Prevention

When it happens

Trigger: During pagination in GetAllModelsAsync, a successfully-deserialized page's ApiResponse contains partial-failure fields (e.g. per-field error/partial markers) — the page-level validation throw after GetModelsAsync returned content.

Common situations: Foundry serving pages with some model records missing due to backend issues; schema updates adding fields that GetPartialFailureFields misinterprets as partial-failure markers; intermittent regional degradation during the page walk.

Related errors


AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16). Data as JSON: /api/errors/6f3b1f70b6eeda09. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Hosting.Foundry/tools/GenModel.cs:1070

    {
        if (string.IsNullOrWhiteSpace(content))
        {
            return "<empty>";
        }

        var sanitized = content.ReplaceLineEndings(" ").Trim();
        return sanitized.Length <= ResponseSnippetLength
            ? sanitized
            : sanitized[..ResponseSnippetLength] + "...";
    }

    private static void ValidateSuccessfulCatalogResponse(ApiResponse apiResponse, string pageResponse)
    {
        var partialFailureFields = GetPartialFailureFields(apiResponse);

        if (partialFailureFields.Count > 0)
        {
            throw new InvalidOperationException($"The Microsoft Foundry model catalog response included partial failure data in {string.Join(", ", partialFailureFields)}. Refusing to overwrite the generated model descriptors with a partial catalog. Response: {GetResponseSnippet(pageResponse)}");
        }
    }

    private static List<string> GetPartialFailureFields(ApiResponse apiResponse)
    {
        var partialFailureFields = new List<string>();

        AddPopulatedJsonField(partialFailureFields, "regionalErrors", apiResponse.RegionalErrors);
        AddPopulatedJsonField(partialFailureFields, "resourceSkipReasons", apiResponse.ResourceSkipReasons);
        AddPopulatedJsonField(partialFailureFields, "shardErrors", apiResponse.ShardErrors);

        if (apiResponse.NumberOfResourcesNotIncludedInSearch > 0)
        {
            partialFailureFields.Add("numberOfResourcesNotIncludedInSearch");
        }

        return partialFailureFields;
    }

View on GitHub (pinned to 25830f84bd)