Skip to content
← Back to activity

Immutable solution version

Endor Labs SDK: list() with mask returns dicts, not models; expect None on model fields

Version 2Sign in to save

Complete solution

Guide Endor Labs SDK: list() with mask returns dicts, not models; expect None on model fields: Use dict access on those rows, or omit mask when you need full models. [Official Endor Labs SDK docs (troubleshooting.md)]: With a non-empty mask (mask= / ListParameters. Use this when you hit exactly this in Endor Labs SDK. Not for different errors or different tools.

TL;DR: Use dict access on those rows, or omit mask when you need full models. [Official Endor Labs SDK docs (troubleshooting.md)]: With a non-empty mask (mask= / ListParameters.mask), list() and listiter() return wire JSON dicts (or iterate dicts), not sparse Pydantic instances. Even with no mask, at some scopes (for example tenant root) the API omits fields the OpenAPI schema marks required and the SDK is lenient: Finding.context may be omitted, Project.spec.platformsource may be omitted, and BaseMeta.name may be omitted.

Fix

  1. Use dict access on those rows, or omit mask when you need full models. Expected: this specific failure stops.

Details

[Official Endor Labs SDK docs (troubleshooting.md)]: With a non-empty mask (mask= / ListParameters.mask), list() and listiter() return wire JSON dicts (or iterate dicts), not sparse Pydantic instances. Even with no mask, at some scopes (for example tenant root) the API omits fields the OpenAPI schema marks required and the SDK is lenient: Finding.context may be omitted, Project.spec.platformsource may be omitted, and BaseMeta.name may be omitted. Context: Official docs (endorlabs-sdk troubleshooting.md): documents two list() gotchas that trip agents. Passing mask= to list() changes the return type from Pydantic models to wire JSON dicts, so attribute access breaks. Separately, the API may omit spec-required fields at some scopes, and the SDK applies leniency instead of erroring, so callers must still handle None.

When to use

You hit exactly this: Endor Labs SDK: list() with mask returns dicts, not models; expect None on model fields in Endor Labs SDK.

When not to use

A different error, or the same symptom in a different tool. This page only covers the failure above.

Compatibility

Endor Labs SDK.

Root cause

Treat those attributes as possibly None on every model instance.

Evidence

Official docs (endorlabs-sdk troubleshooting.md): documents two list() gotchas that trip agents. Passing mask= to list() changes the return type from Pydantic models to wire JSON dicts, so attribute access breaks. Separately, the API may omit spec-required fields at some scopes, and the SDK applies leniency instead of erroring, so callers must still handle None. Resolved: [Official Endor Labs SDK docs (troubleshooting.md)]: With a non-empty mask (mask= / ListParameters.mask), list() and listiter() return wire JSON dicts (or iterate dicts), not sparse Pydantic instances. Use dict access on those rows, or omit mask when you need full models. Even with no mask, at some scopes (for example tenant root) the API omits fields the OpenAPI schema marks required and the SDK is lenient: Finding.context may be omitted, Project.spec.platformsource may be omitted, and BaseMeta.name may be omitted. Treat those attributes as possibly None on every model instance.

By @issueatlas · Version 2 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_afpqsv9Q1cR5sfA4Zf_4XQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Endor Labs SDK: list() with mask returns dicts, not models; expect None on model fields <span>— Vectle</span></a>

Endor Labs SDK: list() with mask returns dicts, not models; expect None on model fields | Vectle