stablyai/orca · error · Error

Unsupported file type in '${normalizeRelativeUploadPath(rela

Error message

Unsupported file type in '${normalizeRelativeUploadPath(relative(rootPath, dirPath))}'

What it means

Thrown by stageDirectoryEntries() when a visited directory path is neither a symlink (checked first) nor a directory — i.e. lstat reports some other type. Because this is a plain Error (not RuntimeUploadSymlinkError), the caller stageOneSourceForRuntimeUpload does not map it to 'skipped'; the source is reported as { status: 'failed', reason: ... }. It indicates a special or replaced node where a directory was expected.

Source

Thrown at src/main/ipc/filesystem-mutations.ts:535

      reason: error instanceof Error ? error.message : String(error)
    }
  }
}

async function stageDirectoryEntries(rootPath: string): Promise<StagedExternalImportEntry[]> {
  const entries: StagedExternalImportEntry[] = [{ relativePath: '', kind: 'directory' }]
  let totalBytes = 0
  const rootRealPath = await realpath(rootPath)

  async function visit(dirPath: string): Promise<void> {
    const dirStat = await lstat(dirPath)
    if (dirStat.isSymbolicLink()) {
      throw new RuntimeUploadSymlinkError(
        `Symlink not allowed in '${normalizeRelativeUploadPath(relative(rootPath, dirPath))}'`
      )
    }
    if (!dirStat.isDirectory()) {
      throw new Error(
        `Unsupported file type in '${normalizeRelativeUploadPath(relative(rootPath, dirPath))}'`
      )
    }
    await assertRealPathInsideRoot(
      rootRealPath,
      dirPath,
      normalizeRelativeUploadPath(relative(rootPath, dirPath))
    )
    const dirEntries = await readdir(dirPath, { withFileTypes: true })
    for (const entry of dirEntries) {
      const childPath = join(dirPath, entry.name)
      const childRelativePath = normalizeRelativeUploadPath(relative(rootPath, childPath))
      if (entry.isSymbolicLink()) {
        throw new RuntimeUploadSymlinkError(`Symlink not allowed in '${childRelativePath}'`)
      }
      if (entry.isDirectory()) {
        entries.push({ relativePath: childRelativePath, kind: 'directory' })
        await visit(childPath)

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Remove the special/unsupported entry from the source tree and re-stage.
  2. If a directory was replaced mid-scan, re-select the source and avoid modifying it during staging.
  3. Restrict upload selections to plain directory/file trees.
Defensive patterns

Strategy: validation

Validate before calling

// Reject special file types where a directory is expected before staging
import { lstat } from 'node:fs/promises'
async function isRealDirectory(p: string): Promise<boolean> {
  try { const s = await lstat(p); return !s.isSymbolicLink() && s.isDirectory() } catch { return false }
}

Try / catch

const res = await stageOneSourceForRuntimeUpload(src)
if (res.status === 'failed' && /Unsupported file type/.test(res.reason ?? '')) {
  // tell the user which path had an unsupported type and abort
}

Prevention

When it happens

Trigger: While staging a directory tree for runtime upload, a path expected to be a directory lstat()s as something else (FIFO, socket, character/block device), or the directory was replaced by a regular file between readdir and lstat (TOCTOU).

Common situations: Tree contains Unix special files (sockets/FIFOs/devices) in a directory slot; a build process replaced a directory with a file mid-scan; platform-specific entries (/dev-style nodes) inside the dropped tree.

Related errors


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