{"record":{"id":"57aa50d1bf6d4895","repo":"stablyai/orca","slug":"unsupported-file-type-in-normalizerelativeuploa","errorCode":null,"errorMessage":"Unsupported file type in '${normalizeRelativeUploadPath(relative(rootPath, dirPath))}'","messagePattern":"Unsupported file type in '(.+?)'","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/ipc/filesystem-mutations.ts","lineNumber":535,"sourceCode":"      reason: error instanceof Error ? error.message : String(error)\n    }\n  }\n}\n\nasync function stageDirectoryEntries(rootPath: string): Promise<StagedExternalImportEntry[]> {\n  const entries: StagedExternalImportEntry[] = [{ relativePath: '', kind: 'directory' }]\n  let totalBytes = 0\n  const rootRealPath = await realpath(rootPath)\n\n  async function visit(dirPath: string): Promise<void> {\n    const dirStat = await lstat(dirPath)\n    if (dirStat.isSymbolicLink()) {\n      throw new RuntimeUploadSymlinkError(\n        `Symlink not allowed in '${normalizeRelativeUploadPath(relative(rootPath, dirPath))}'`\n      )\n    }\n    if (!dirStat.isDirectory()) {\n      throw new Error(\n        `Unsupported file type in '${normalizeRelativeUploadPath(relative(rootPath, dirPath))}'`\n      )\n    }\n    await assertRealPathInsideRoot(\n      rootRealPath,\n      dirPath,\n      normalizeRelativeUploadPath(relative(rootPath, dirPath))\n    )\n    const dirEntries = await readdir(dirPath, { withFileTypes: true })\n    for (const entry of dirEntries) {\n      const childPath = join(dirPath, entry.name)\n      const childRelativePath = normalizeRelativeUploadPath(relative(rootPath, childPath))\n      if (entry.isSymbolicLink()) {\n        throw new RuntimeUploadSymlinkError(`Symlink not allowed in '${childRelativePath}'`)\n      }\n      if (entry.isDirectory()) {\n        entries.push({ relativePath: childRelativePath, kind: 'directory' })\n        await visit(childPath)","sourceCodeStart":517,"sourceCodeEnd":553,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/filesystem-mutations.ts#L517-L553","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Remove the special/unsupported entry from the source tree and re-stage.","If a directory was replaced mid-scan, re-select the source and avoid modifying it during staging.","Restrict upload selections to plain directory/file trees."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Reject special file types where a directory is expected before staging\nimport { lstat } from 'node:fs/promises'\nasync function isRealDirectory(p: string): Promise<boolean> {\n  try { const s = await lstat(p); return !s.isSymbolicLink() && s.isDirectory() } catch { return false }\n}","typeGuard":null,"tryCatchPattern":"const res = await stageOneSourceForRuntimeUpload(src)\nif (res.status === 'failed' && /Unsupported file type/.test(res.reason ?? '')) {\n  // tell the user which path had an unsupported type and abort\n}","preventionTips":["Restrict upload selections to plain directory/file trees.","Remove special files (sockets/FIFOs/devices) from source directories before staging.","Avoid modifying the source tree (replacing dirs with files) during staging."],"tags":["filesystem","upload","runtime-upload","staging","unsupported-type"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}