stablyai/orca · warning
Selected file is not a markdown document.
Error message
Selected file is not a markdown document.
What it means
Thrown by the markdown-file-open IPC handler after the OS open dialog returns a path that fails isMarkdownDocumentName. Although the dialog filters by extensions ['md','mdx','markdown'], some platforms/dialog modes allow bypassing the filter (e.g. entering a full path, all-files mode, or programmatic invocation), so the handler re-validates the extension before authorizing access.
Source
Thrown at src/main/ipc/app.ts:57
async function pickFloatingMarkdownDocument(
event: IpcMainInvokeEvent
): Promise<MarkdownDocument | null> {
const cwd = await ensureDefaultFloatingWorkspacePath()
const options = {
defaultPath: cwd,
properties: ['openFile'],
filters: [{ name: 'Markdown', extensions: ['md', 'mdx', 'markdown'] }]
} satisfies Electron.OpenDialogOptions
const parentWindow = BrowserWindow.fromWebContents(event.sender)
const result = parentWindow
? await dialog.showOpenDialog(parentWindow, options)
: await dialog.showOpenDialog(options)
if (result.canceled || result.filePaths.length === 0) {
return null
}
const filePath = result.filePaths[0]
if (!isMarkdownDocumentName(filePath)) {
throw new Error('Selected file is not a markdown document.')
}
authorizeExternalPath(filePath)
return markdownDocumentFromFilePath(cwd, filePath, { outsideRootRelativePath: 'basename' })
}
async function pickFloatingWorkspaceDirectory(
event: IpcMainInvokeEvent,
store: Store
): Promise<string | null> {
const parentWindow = BrowserWindow.fromWebContents(event.sender)
const options = {
// Why: this picker only grants access to an existing directory; creation belongs to explicit file actions.
properties: ['openDirectory']
} satisfies Electron.OpenDialogOptions
const result = parentWindow
? await dialog.showOpenDialog(parentWindow, options)
: await dialog.showOpenDialog(options)
if (result.canceled || result.filePaths.length === 0) {View on GitHub (pinned to 1136503c6a)
Solutions
- Pick a file with a .md, .mdx, or .markdown extension.
- If the document is in another format, convert/rename it to .md first.
- Ensure the dialog is opened with the Markdown filter active and the user doesn't switch to All Files.
Defensive patterns
Strategy: validation
Validate before calling
const MARKDOWN_EXT = /\.(md|mdx|markdown)$/i
function isMarkdownDocumentName(filePath: string): boolean {
return MARKDOWN_EXT.test(filePath)
} Type guard
function isMarkdownDocumentName(filePath: unknown): filePath is string {
return typeof filePath === 'string' && /\.(md|mdx|markdown)$/i.test(filePath)
} Prevention
- Guide users to keep the Markdown filter active in the dialog.
- Re-validate the extension server-side even when a filter is set — filters are advisory on some platforms.
- Surface a clear message asking the user to pick a .md/.mdx/.markdown file.
When it happens
Trigger: User selects or types a path whose extension isn't .md/.mdx/.markdown despite the filter; the dialog is invoked in a mode that ignores filters; a renderer passes a filePath directly that wasn't filtered. Also possible on platforms where the filter is advisory.
Common situations: User selects 'All Files' and picks a .txt or .docx; path typed manually with wrong extension; cross-platform dialog behavior differences; programmatic call bypassing the dialog.
Related errors
- Cannot download to a directory
- Cannot download a directory
- content is required
- Repo path must be an absolute path
- benchmark produced an empty TOC; document generation is brok
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/186b6f8409748929.
Report an issue: GitHub.