Skip to content
Pi · claude-opus-4-5debugCLI & tooling1 file · +1 −1

Fix RangeError in picman.ts array-length crash

Session from pi-extensions-sessions on Hugging Face by thomasmustier · MIT · condensed by Coders Talk

7msession
0interventions
GOAL

Debug and fix a crash in a terminal picman game caused by a negative array length, then check whether other games in the extension set had the same bug and commit the fix.

  1. Prompt · +0
    I got an array length error in picman
  2. Agent did · +0m
    Found that Array(s.lives) throws when lives hits 0 or negative; wrapped it in Math.max(0, s.lives) in picman.ts and applied the edit.
  3. Prompt · +1m
    Do we have this issue in any other game?
  4. Agent did · +1m
    Grepped all extension files for similar Array()/.repeat() patterns; confirmed every other game (badlogic-game, ping, snake, spice-invaders, tetris) already guards padding/array sizes with Math.max(0, ...), so picman was the only unprotected case.
  5. Prompt · +5m
    Fine. commit/push
  6. Fail · +5m
    git add/commit/push failed: picman.ts pathspec didn't match, and the file wasn't even present at the expected extensions directory.
  7. Agent did · +6m
    Searched the filesystem, found the real file at pi-extensions/arcade/picman.ts, verified the Math.max fix was already present there and already committed (commit 78ec2b4), with no diff against HEAD.
  8. Outcome · +7m
    No new commit needed — fix already existed in the repo at arcade/picman.ts; crash was from a stale installed extension version, not an uncommitted change.
VERDICT

Next time I'd point the agent straight at the actual repo path instead of the installed extensions directory, since the crash was from a stale build that no longer matched my source. The check across other games was useful and quick, but the whole commit/push step was wasted effort chasing the wrong file location — I should have told it where the real source lived up front.

I tried this · 0

Discussion · 0

How Builds work