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

  1. Pick a file with a .md, .mdx, or .markdown extension.
  2. If the document is in another format, convert/rename it to .md first.
  3. 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

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


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/186b6f8409748929. Report an issue: GitHub.