{"record":{"id":"4554d70b262e7283","repo":"stablyai/orca","slug":"unsupported-file-type-in-basename-srcpath","errorCode":null,"errorMessage":"Unsupported file type in '${basename(srcPath)}'","messagePattern":"Unsupported file type in '(.+?)'","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/ipc/filesystem-mutations.ts","lineNumber":718,"sourceCode":"    }\n    if (!statResult.isFile()) {\n      throw new Error(`Unsupported file type in '${entry.name}'`)\n    }\n    await copyLocalFileNoFollow(srcPath, dstPath, statResult)\n  }\n}\n\nasync function copyLocalFileNoFollow(\n  srcPath: string,\n  dstPath: string,\n  statResult?: Awaited<ReturnType<typeof lstat>>\n): Promise<void> {\n  const beforeOpenStat = statResult ?? (await lstat(srcPath))\n  if (beforeOpenStat.isSymbolicLink()) {\n    throw new Error(`Symlink not allowed in '${basename(srcPath)}'`)\n  }\n  if (!beforeOpenStat.isFile()) {\n    throw new Error(`Unsupported file type in '${basename(srcPath)}'`)\n  }\n\n  let destinationCreated = false\n  const sourceHandle = await open(srcPath, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0))\n  let destinationHandle: Awaited<ReturnType<typeof open>> | null = null\n  try {\n    const openedStat = await sourceHandle.stat()\n    if (\n      !openedStat.isFile() ||\n      (typeof beforeOpenStat.size === 'number' && openedStat.size !== beforeOpenStat.size) ||\n      (typeof beforeOpenStat.ino === 'number' &&\n        beforeOpenStat.ino !== 0 &&\n        openedStat.ino !== 0 &&\n        openedStat.ino !== beforeOpenStat.ino) ||\n      (typeof beforeOpenStat.dev === 'number' &&\n        beforeOpenStat.dev !== 0 &&\n        openedStat.dev !== 0 &&\n        openedStat.dev !== beforeOpenStat.dev)","sourceCodeStart":700,"sourceCodeEnd":736,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/filesystem-mutations.ts#L700-L736","documentation":"Thrown in copyLocalFileNoFollow during local import of a single file. The pre-open lstat shows the source is neither a symlink nor a regular file (isFile() false). This rejects special files like FIFOs, sockets, and device nodes that cannot be copied as file content.","triggerScenarios":"Importing a single top-level source path that is a special file type. The lstat reports isFile() false after the symlink check passes, meaning the path is a FIFO, socket, block, or character device.","commonSituations":"Attempting to import a named pipe, Unix socket, or device file. Importing a path from /dev or /var/run. A file manager or script provides a path to a non-regular file.","solutions":["Check the file type with `file /path/to/source` or `ls -la` and confirm it is a regular file.","Remove the special file or redirect the import to the actual regular file.","If importing from a script, add a type check before invoking the import IPC."],"exampleFix":"// before: import /tmp/app.sock (a Unix socket)\n// after: target a real file\n//   import /tmp/app.log instead of /tmp/app.sock","handlingStrategy":"type-guard","validationCode":"const { lstat } = await import('node:fs/promises')\n\nasync function assertRegularFile(filePath: string): Promise<void> {\n  const st = await lstat(filePath)\n  if (!st.isFile()) {\n    throw new Error(`${filePath} is not a regular file (type: ${describeType(st)})`)\n  }\n}\nfunction describeType(st: { isFile(): boolean; isDirectory(): boolean; isSymbolicLink(): boolean; isFIFO(): boolean; isSocket(): boolean }): string {\n  if (st.isDirectory()) return 'directory'\n  if (st.isSymbolicLink()) return 'symlink'\n  if (st.isFIFO()) return 'fifo'\n  if (st.isSocket()) return 'socket'\n  return 'special'\n}","typeGuard":"async function isRegularFile(filePath: string): Promise<boolean> {\n  const { lstat } = await import('node:fs/promises')\n  try {\n    return (await lstat(filePath)).isFile()\n  } catch {\n    return false\n  }\n}","tryCatchPattern":"try {\n  await importLocalSource(sourcePath, destDir)\n} catch (error) {\n  if (error instanceof Error && error.message.startsWith('Unsupported file type')) {\n    showUserError(`${error.message} — the source is not a regular file.`)\n    return\n  }\n  throw error\n}","preventionTips":["Verify file type with `file <path>` or `ls -la` before importing single files.","Do not import paths from /dev, /var/run, or other special filesystems.","In import UIs, disable the action for non-regular file selections."],"tags":["filesystem","local-import","unsupported-type","ipc"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}