Export command includes status message in JSON output #8518

Open
opened 2026-02-16 18:10:10 -05:00 by yindo · 1 comment
Owner

Originally created by @pascalandr on GitHub (Feb 4, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

When using opencode export <session_id> > file.json, the exported file contains a status message prefix that makes the JSON invalid.

Steps to Reproduce

  1. Export a session to a file:

    opencode export ses_xxxxx > session.json
    
  2. Check the file content - observe:

    Exporting session: ses_xxxxx{
      "info": {
        "id": "ses_xxxxx",
    

Expected Behavior

The exported file should contain only valid JSON (no status message).

Actual Behavior

The status message Exporting session: ses_xxxxx is written to stdout and gets captured in the redirect, making the JSON invalid. opencode import then fails with "File not found" error.

Workaround

Redirect stderr separately:

opencode export ses_xxxxx 2>/dev/null > session.json

Environment

  • OS: Windows 11
  • OpenCode version: 1.1.48
Originally created by @pascalandr on GitHub (Feb 4, 2026). Originally assigned to: @rekram1-node on GitHub. ## Description When using `opencode export <session_id> > file.json`, the exported file contains a status message prefix that makes the JSON invalid. ## Steps to Reproduce 1. Export a session to a file: ```bash opencode export ses_xxxxx > session.json ``` 2. Check the file content - observe: ``` Exporting session: ses_xxxxx{ "info": { "id": "ses_xxxxx", ``` ## Expected Behavior The exported file should contain only valid JSON (no status message). ## Actual Behavior The status message `Exporting session: ses_xxxxx` is written to stdout and gets captured in the redirect, making the JSON invalid. `opencode import` then fails with "File not found" error. ## Workaround Redirect stderr separately: ```bash opencode export ses_xxxxx 2>/dev/null > session.json ``` ## Environment - OS: Windows 11 - OpenCode version: 1.1.48
yindo added the windows label 2026-02-16 18:10:10 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 4, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #7426: opencode export outputs messages in wrong order for long sessions (related export command output issues)
  • #11923: Export session on Windows disables opencode (Windows-related export issues)
  • #10159: /export command only exports visible viewport content, not full session history after compaction (export command functionality issues)

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Feb 4, 2026): This issue might be a duplicate of existing issues. Please check: - #7426: opencode export outputs messages in wrong order for long sessions (related export command output issues) - #11923: Export session on Windows disables opencode (Windows-related export issues) - #10159: /export command only exports visible viewport content, not full session history after compaction (export command functionality issues) Feel free to ignore if none of these address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8518