stablyai/orca · error · Error
Download session not found
Error message
Download session not found
What it means
Thrown by 'fs:appendDownloadedFileChunk' (src/main/ipc/filesystem.ts:785) when downloadSessions.get(transferId) returns undefined. Download sessions live in an in-memory Map keyed by transferId; they are created by fs:startDownloadedFile and removed by fs:finishDownloadedFile, fs:cancelDownloadedFile, a 30-minute TTL cleanup timer (DOWNLOAD_SESSION_TTL_MS), or cleanupDownloadSessionsForSender when the owning webContents is destroyed.
Source
Thrown at src/main/ipc/filesystem.ts:785
return { canceled: false, transferId, destinationPath }
} catch (error) {
await cleanupLocalTransferPath(tempPath)
throw error
}
}
)
ipcMain.handle(
'fs:appendDownloadedFileChunk',
async (
_event,
args: { transferId?: string; contentBase64?: string }
): Promise<{ ok: true }> => {
const transferId = validateRequiredString(args?.transferId, 'transferId')
const contentBase64 = validateRequiredString(args?.contentBase64, 'contentBase64')
const session = downloadSessions.get(transferId)
if (!session) {
throw new Error('Download session not found')
}
await session.handle.writeFile(Buffer.from(contentBase64, 'base64'))
return { ok: true }
}
)
ipcMain.handle(
'fs:finishDownloadedFile',
async (
_event,
args: { transferId?: string }
): Promise<{ canceled: false; destinationPath: string }> => {
const transferId = validateRequiredString(args?.transferId, 'transferId')
const session = await closeDownloadSession(transferId, false)
if (!session) {
throw new Error('Download session not found')
}
let promoted = falseView on GitHub (pinned to 1136503c6a)
Solutions
- Restart the download via fs:startDownloadedFile to obtain a fresh transferId, then re-stream the file.
- Ensure the full append sequence completes within the 30-minute TTL and before the owning window closes.
- Confirm the transferId matches the most recent start response and that the same webContents issued it.
Example fix
// before: appending after the session was finished/expired
await invoke('fs:appendDownloadedFileChunk', { transferId: staleId, contentBase64 })
// after: restart on session-not-found, then continue
try { await invoke('fs:appendDownloadedFileChunk', { transferId, contentBase64 }) }
catch (e) {
if (/session not found/.test(e.message)) {
const r = await invoke('fs:startDownloadedFile', { suggestedName })
transferId = r.transferId
} else throw e
} Defensive patterns
Strategy: validation
Validate before calling
// Track transfer lifecycle in the renderer; treat append as valid only while 'active'.
function canAppend(t: { id: string; state: 'active' | 'done' | 'canceled' }): boolean {
return t.state === 'active'
} Try / catch
try {
await invoke('fs:appendDownloadedFileChunk', { transferId, contentBase64 })
} catch (e) {
if (e instanceof Error && /session not found/.test(e.message)) {
// restart: fs:startDownloadedFile -> new transferId -> re-stream from the beginning
} else throw e
} Prevention
- Finish transfers well within the 30-minute TTL.
- Cancel (fs:cancelDownloadedFile) on window unload so sessions do not leak.
- Do not reuse a transferId across a window reload/reconnect.
When it happens
Trigger: An append chunk arriving for a transferId whose session was already closed: finish/cancel ran first, the 30-min TTL timer fired, the sender window was destroyed/reloaded, or the transferId was never started or belongs to a different sender.
Common situations: Very large or paused transfers exceeding the 30-minute TTL; renderer resuming a download after the window closed and reopened; a double-finish/cancel race; stale transferId held across an SSH reconnect that tore down app state.
Related errors
- config/scripts/install-electron-package-binary.mjs exited wi
- review file has expired; create a new one before sending
- review file has expired; create a new one before opening
- Unknown ephemeral VM runtime: ${runtimeId}
- Unknown ephemeral VM runtime: ${args.runtimeId}
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/afc73d9b4ffe3bf2.
Report an issue: GitHub.