stablyai/orca · error · Error
content is required
Error message
content is required
What it means
Thrown by the 'fs:saveDownloadedFile' handler (src/main/ipc/filesystem.ts:692) when args.content is not a string. This handler is the 'save already-fetched content' path (distinct from the streaming start/append/finish flow); the contract requires content be passed as a utf8 or base64 string. Non-string payloads are rejected at the IPC boundary before any disk write.
Source
Thrown at src/main/ipc/filesystem.ts:692
await cleanupLocalTransferPath(tempPath)
}
}
}
)
registerFilesystemDownloadFolderHandlers()
ipcMain.handle(
'fs:saveDownloadedFile',
async (
event,
args: { suggestedName?: string; content?: string; encoding?: 'utf8' | 'base64' }
): Promise<DownloadFileResult> => {
const suggestedName = sanitizeLocalDownloadFilename(
validateRequiredString(args?.suggestedName, 'suggestedName')
)
if (typeof args?.content !== 'string') {
throw new Error('content is required')
}
const content = args.content
const encoding = args?.encoding === 'base64' ? 'base64' : 'utf8'
const parentWindow = BrowserWindow.fromWebContents(event.sender) ?? undefined
const dialogResult = parentWindow
? await dialog.showSaveDialog(parentWindow, { defaultPath: suggestedName })
: await dialog.showSaveDialog({ defaultPath: suggestedName })
if (dialogResult.canceled || !dialogResult.filePath) {
return { canceled: true }
}
const destinationPath = dialogResult.filePath
const { existed } = await inspectDownloadDestination(destinationPath)
const tempPath = createSiblingTransferPath(destinationPath, 'download')
let promoted = false
try {
await writeFile(tempPath, decodeDownloadedFileContent(content, encoding))
await promoteDownloadedFile(tempPath, destinationPath, existed)View on GitHub (pinned to 1136503c6a)
Solutions
- Pass content as a string, with encoding:'base64' for binary data, in the invoke payload.
- For large or streaming files, switch to fs:startDownloadedFile + fs:appendDownloadedFileChunk + fs:finishDownloadedFile instead of fs:saveDownloadedFile.
- Add a renderer-side type check on the payload so the error surfaces at the call site, not over IPC.
Example fix
// before: content missing
await invoke('fs:saveDownloadedFile', { suggestedName: 'log.txt' })
// after: content provided, base64 for binary
await invoke('fs:saveDownloadedFile', {
suggestedName: 'logo.png',
content: bytes.toString('base64'),
encoding: 'base64'
}) Defensive patterns
Strategy: validation
Validate before calling
function isValidSaveArgs(a: unknown): a is { suggestedName: string; content: string; encoding?: 'utf8' | 'base64' } {
return typeof (a as any)?.suggestedName === 'string'
&& typeof (a as any)?.content === 'string'
} Type guard
const isStringContent = (a: unknown): a is { content: string } =>
typeof (a as { content?: unknown })?.content === 'string' Prevention
- Type the invoke payload with the shared IPC types so missing content fails at compile time.
- For binary, set encoding:'base64' and pass a base64 string, never a Buffer/TypedArray.
- Use the streaming start/append/finish flow for large files instead of saveDownloadedFile.
When it happens
Trigger: Calling ipcRenderer.invoke('fs:saveDownloadedFile', { suggestedName, content }) with content omitted, undefined, null, a number, or a binary buffer/TypedArray instead of a base64 string. The `typeof args?.content !== 'string'` guard fires before sanitizeLocalDownloadFilename is reached again.
Common situations: Renderer refactor that stopped threading content through; a binary file saved without setting encoding:'base64'; a code path passing a Uint8Array/Buffer directly; an event payload that was JSON-round-tripped and dropped an undefined field.
Related errors
- Selected file is not a markdown document.
- Cannot download to a directory
- Cannot download a directory
- Repo path must be an absolute path
- Couldn't verify the SSH connection. Reconnect the host and t
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/031ecf5a39b103f8.
Report an issue: GitHub.