Conversation
`apify actors ls` read `item.actor.stats.totalBuilds` behind an `item.actor` null check only. The API omits `stats` on some Actor records, so the command exited with `Cannot read properties of undefined (reading 'totalBuilds')`. apify-client types `Actor.stats` as required, so TypeScript did not flag it. The e2e tests all pass `--json`, which returns before the table is rendered, so the path was untested. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
l2ysho
marked this pull request as ready for review
September 11, 2026 15:20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
apify actors lscrashed withCannot read properties of undefined (reading 'totalBuilds'). Thestatsfield is missing on some Actor records; the code only guardeditem.actor. One-line guard plus a regression test.What changed
src/commands/actors/ls.ts—item.actor ? …→item.actor?.stats ? …for theBuildscolumn.test/local/commands/actors-ls.test.ts— renders the table with an Actor record that has nostats. Fails onmasterwith the exact error above.Why it happened
apify-clienttypesActor.statsas required (ActorStats), so TypeScript saw the access as safe. The API does not always send it.Buildsvalue is computed for both tables even though only the--mytable shows that column, so plainapify actors lshits it too.--json, which returns before table rendering. The render path had no coverage.Notes
apify-client'sActorStatsis inaccurate in two more ways:totalMetamorphsis required but absent from 3 of 5 public Actor responses I checked, andpublicActorRunStats30Days,actorReviewCount,actorReviewRating,bookmarkCountare returned but undeclared. Worth a separate issue onapify-client-js.Reported by @mtrunkat in #cli.
🤖 Generated with Claude Code