deepseek-ai/deepseek-harness · error · SessionForkError
OPEN_TURN
OPEN_TURN
Error message
fork boundary ${boundary} in session "${session.id}" ends inside open turn ${lastTurnBoundary.data.turn} What it means
SessionForkError with code OPEN_TURN: the fork boundary lands inside an open turn. The event slice up to the boundary ends with a turn/start whose matching turn/end lies after the boundary, so the forked child would inherit a half turn. Forks may end on a between-turn event but never mid-turn.
Solutions
- Move the boundary to the turn/end event or later
- Omit the boundary to fork through the source's current last event (safe once the turn has closed)
- Wait for the in-flight turn to finish before forking
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/core/session/src/index.ts:1131 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24).
Data as JSON: /api/errors/3d1aacb7ff6aacba.
Report an issue: GitHub.
Appendix: source
Thrown at packages/core/session/src/index.ts:1131
if (boundary >= events.length) {
const lastSeq = events.at(-1)?.seq
throw new SessionForkError(
`fork boundary ${boundary} does not exist in session "${session.id}" (last seq: ${lastSeq ?? 'none'})`,
'INVALID_BOUNDARY',
)
}
const boundaryEvent = events[boundary]
if (boundaryEvent === undefined || boundaryEvent.seq !== boundary) {
throw new SessionForkError(
`fork boundary ${boundary} does not match a contiguous event seq in session "${session.id}"`,
'INVALID_BOUNDARY',
)
}
const lastTurnBoundary = events.slice(0, boundary + 1)
.findLast(event => event.type === 'turn/start' || event.type === 'turn/end')
if (lastTurnBoundary?.type === 'turn/start') {
throw new SessionForkError(
`fork boundary ${boundary} in session "${session.id}" ends inside open turn ${lastTurnBoundary.data.turn}`,
'OPEN_TURN',
)
}
return events.slice(0, boundary + 1)
}
private _resolveForkSource(source: SessionForkSource): Session {
if (typeof source === 'string') {
const session = this.get(source)
if (session === undefined) throw new SessionForkError(`session "${source}" not found`, 'SESSION_NOT_FOUND')
return session
}
const live = this.get(source.id)
if (live === undefined) {
throw new SessionForkError(`session "${source.id}" not found`, 'SESSION_NOT_FOUND')View on GitHub (pinned to b150a551b8)