anomalyco / anomalyco/opencode
session: v2 import rejects V1 export JSON and its own export file (SchemaError missing keys)
Open
@jlongster is already working on this.
Since Sep 16, 2026.
2.0
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
v2.0.4 session import fails on both V1's opencode export output and V2's own
session export output — the exporter omits keys the importer requires. V1
sessions created after installing V2 have no supported migration path, and
export → import round-trips fail.
Environment
- opencode 2.0.4 (
opencode2, npm@opencode/cli), V1 1.18.31 (winget) - OS: Windows 11 (build 10.0.26100.8655)
- Shell: pwsh 7.6.6
- Plugins: @slkiser/opencode-quota@latest
Repro
- V1:
opencode export <id> > s.json→ V2:opencode2 session import s.json
→SchemaError: Missing key ["info"]["location"](V1 exportsinfo.directory) - Fix
info→Missing key [...]["state"]["error"]— importer requires
state.erroron every tool part opencode2 session export <id> > v2.json, re-import → samestate.error
failure: exporter omitserroron 58/59 tool parts, so V2's own export
can't round-trip- Add
erroreverywhere →Missing key [...]["state"]["content"][0]—
exporter omitscontenton error-status tools, importer wants non-empty
Expected
Import accepts V1 export JSON, and V2's own export round-trips.
Notes
- Consistent, not intermittent. Same class as #21941 (fixed in 1.4.3, recurred here).
- Install-time V1 migration gap is #41217 — CLI import is the only path for
sessions created after install. - Import endpoint undocumented/experimental; migration guide has no session section.
- Worked around with a custom converter (V1 → v2 shape); 736 msgs / 570 tool
parts imported fine after.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.