Skip to content

[web-shared] Copy button puts "[object Object]" on the clipboard when a payload contains a BigInt #5511

Closed

Description

@abhiramshaji-cyber

Hi all, hope you're doing well! Thanks for the BigInt work in #5328, and for the clipboard tests in #2584, both made this really easy to track down.

Summary

In the web UI, copying a step input, output or event payload that contains a BigInt anywhere below the top level gives you [object Object] (or 1,2 for an array) instead of JSON.

What the copy button is for

The copy button next to each data block in the run sidebar is how I grab a step's input or output to paste into a test, a bug report or a replay. The sidebar itself shows BigInt values fine; only the copied text is wrong.

Current behavior

  1. Call a workflow step with { id: 1n } as its argument.
  2. Open the run in the web UI and select that step.
  3. Click copy on the input block.
  4. The clipboard holds [object Object].

serializeForClipboard calls JSON.stringify(value, null, 2) with no replacer, so any nested BigInt throws, and the catch falls back to String(value):

export const serializeForClipboard = (value: unknown): string => {
if (typeof value === 'string') return value;
if (
typeof value === 'number' ||
typeof value === 'boolean' ||
value === null
) {
return String(value);
}
try {
return JSON.stringify(value, null, 2);
} catch {
return String(value);
}
};

The values really do reach it as BigInts: core writes a BigInt tag (packages/core/src/serialization/reducers/common.ts L236), and the web hydration revives it with BigInt: (value) => BigInt(value):

BigInt: (value: string) => BigInt(value),

From there it goes to <CopyableDataBlock data={value} /> (attribute-panel.tsx, attributes-block.tsx, events-list.tsx), and serializeForClipboard is also called directly from event-details-panel.tsx L139 and stream-viewer.tsx L58.

serializeForClipboard and the components that call it

serializeForClipboard with the CopyableDataBlock and PayloadView components that call it, Functions view in Architect

Expected behavior

Valid JSON with each BigInt written as a string, the same way the CLI prints it after #5328.

Minimal repro

I copied the function verbatim into node on ad36891:

Input Copied text
10n 10 (right, but only because String(10n) happens to match)
{ amount: 10n, name: 'x' } [object Object]
[1n, 2n] 1,2
[{ id: 1n }] [object Object]
{ input: [{ a: { b: 5n } }] } [object Object]

The tests in packages/web-shared/test/copyable-data-block.test.ts (L52 to L62) only cover the top level 10n case, which is probably why this slipped by. #2584 mentions the String fallback covering "circular refs and BigInt", so I think the nested case just wasn't in view.

Questions

  • Would you be open to reusing the replacer from [cli] Fix BigInt crashes in inspect and stream output #5328 (packages/cli/src/lib/inspect/json.ts L8) in serializeForClipboard? I'd be happy to open a small PR with a test for the nested cases.
  • For circular objects, should they keep the current [object Object] fallback? The same test block expects that today, so I'd leave it alone unless you'd prefer something else.
  • formatMetadataValue in attributes-block.tsx (L200 to L213) looks like the same pattern. I also wonder whether a hydrated Map or Set copies as {}, but I haven't checked that yet.

Thanks so much for taking a look, and any tips are very welcome!

Activity

  1. added a commit that references this issue on Nov 18, 2026
    d385e43
  2. added a commit that references this issue on Nov 18, 2026
    9d086e1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions