Skip to content

schemaforge entity list --fields returns empty entities[] despite non-zero total_count #73

Description

@rrrodzilla

Summary

schemaforge entity list <Schema> --fields ... returns entities: [] and count: 0 even when total_count is non-zero. Dropping --fields returns the entities normally with the same query. Affects both single-field and multi-field projections.

Reproduction

Against a running SchemaForge instance (here: Engage on 0.32.1):

# Without --fields — works
$ SCHEMAFORGE_SERVER=https://engage.internal.govcraft.ai \
    schemaforge entity list Opportunity --limit 2 --format json \
  | jq '{total_count, count, entities_returned: (.entities|length)}'
{
  "total_count": 145,
  "count": 2,
  "entities_returned": 2
}

# With --fields title,capture_stage — empty
$ SCHEMAFORGE_SERVER=https://engage.internal.govcraft.ai \
    schemaforge entity list Opportunity --limit 2 --fields title,capture_stage --format json \
  | jq '{total_count, count, entities_returned: (.entities|length)}'
{
  "total_count": 145,
  "count": 0,
  "entities_returned": 0
}

# With single field --fields title — same empty result
$ SCHEMAFORGE_SERVER=https://engage.internal.govcraft.ai \
    schemaforge entity list Opportunity --limit 2 --fields title --format json \
  | jq '{total_count, count, entities_returned: (.entities|length)}'
{
  "total_count": 145,
  "count": 0,
  "entities_returned": 0
}

total_count of 145 confirms the underlying query is counting rows; only the projection / serialization path is dropping them.

Expected

--fields title,capture_stage should return entities with id plus the projected fields, matching total_count's row count up to --limit.

Actual

entities: [], count: 0. No error or warning is surfaced.

Workaround

Drop --fields and project client-side:

schemaforge entity list Opportunity --limit 25 --format json \
  | jq '.entities[] | {id, title: .fields.title, capture: .fields.capture_stage}'

This is fine for small result sets but defeats the bandwidth/latency reason --fields exists in the first place.

Environment

  • schemaforge --versionschemaforge 0.32.1
  • Target server: Engage app (SchemaForge PostgreSQL backend, REST API)
  • Reproduced on the Opportunity schema; likely affects every schema over the entity REST API, but I haven't exhaustively confirmed.

Notes

  • The server returns 200, not an error — the empty array looks "successful" to a naive caller.
  • count mirroring 0 instead of the projected row count suggests the bug is on the result-set assembly side, not just JSON serialization.
  • Worth checking whether entity get <Schema> <id> --fields ... and entity query ... --fields ... share the same path and exhibit the same issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions