Skip to content
This repository was archived by the owner on Mar 27, 2026. It is now read-only.

Improve sandbox error message with JSON.stringify#218

Draft
TakshPSingh wants to merge 1 commit intomodal-labs:mainfrom
TakshPSingh:patch-1
Draft

Improve sandbox error message with JSON.stringify#218
TakshPSingh wants to merge 1 commit intomodal-labs:mainfrom
TakshPSingh:patch-1

Conversation

@TakshPSingh
Copy link
Copy Markdown

@TakshPSingh TakshPSingh commented Nov 14, 2025

Note

Improve Sandbox completed error message by JSON-stringifying taskResult for clearer output.

Written by Cursor Bugbot for commit 60f885e. This will update automatically on new commits. Configure here.

@TakshPSingh TakshPSingh marked this pull request as draft November 14, 2025 20:58
Comment thread modal-js/src/sandbox.ts
if (resp.taskResult) {
throw new Error(
`Sandbox ${this.sandboxId} has already completed with result: ${resp.taskResult}`,
`Sandbox ${this.sandboxId} has already completed with result: ${JSON.stringify(resp.taskResult)}`,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Serialization Errors Mask Real Problem Messages

JSON.stringify(resp.taskResult) can throw a TypeError if the protobuf object contains circular references, BigInt values, or other non-serializable properties. This would replace the intended error message with a confusing serialization error. The codebase shows awareness of this risk in grpc_mock.ts where JSON.stringify is wrapped in try-catch with a fallback to String().

Fix in Cursor Fix in Web

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant