Older local sessions can contain message and part rows written before the current MessageV2 schemas required several fields. After upgrading opencode, reading those sessions can fail because API/read paths hydrate the historical DB rows and then validate or serve them as the current message shape.
This is not limited to import/export. It can affect existing local sessions through endpoints and services such as:
GET /session/:id/message
GET /session/:id/message/:messageID
MessageV2.page
Session.messages
MessageV2.get
MessageV2.parts
Observed example error from a legacy session shape:
Legacy rows may also be missing fields that are now required, including:
- message
agent
- user message
model
- assistant message
parentID
step-finish.reason
The fix should preserve strict current schemas while normalizing historical rows at the read/import boundary so old sessions continue to work after upgrades.
Older local sessions can contain message and part rows written before the current
MessageV2schemas required several fields. After upgrading opencode, reading those sessions can fail because API/read paths hydrate the historical DB rows and then validate or serve them as the current message shape.This is not limited to import/export. It can affect existing local sessions through endpoints and services such as:
GET /session/:id/messageGET /session/:id/message/:messageIDMessageV2.pageSession.messagesMessageV2.getMessageV2.partsObserved example error from a legacy session shape:
Legacy rows may also be missing fields that are now required, including:
agentmodelparentIDstep-finish.reasonThe fix should preserve strict current schemas while normalizing historical rows at the read/import boundary so old sessions continue to work after upgrades.