stablyai/orca · error

Clone destination must be an absolute path

Error message

Clone destination must be an absolute path

What it means

deriveValidatedClonePath throws when args.destination is empty, is not an absolute path, or — on a non-Windows host — looks like a Windows absolute path (a Linux/macOS host must not accept a Windows drive path as the clone destination). This is the entry guard before the repo name is even derived; it refuses to proceed with a destination that cannot be safely joined.

Source

Thrown at src/main/git/repo-clone-path.ts:38

  const source = url.replace(/\.git\/?$/, '')
  const isWindowsLocalSource = /^[A-Za-z]:[\\/]/.test(source) || source.startsWith('\\\\')
  const repoName = isWindowsLocalSource ? win32.basename(source) : posix.basename(source)
  if (!repoName || repoName === '.' || repoName === '..') {
    throw new Error('Invalid repository name derived from URL')
  }
  if (repoName.includes('/') || repoName.includes('\\')) {
    throw new Error('Invalid repository name derived from URL')
  }
  return repoName
}

export function deriveValidatedClonePath(args: { url: string; destination: string }): string {
  if (
    !args.destination ||
    !isAbsolute(args.destination) ||
    (process.platform !== 'win32' && isWindowsAbsolutePathLike(args.destination))
  ) {
    throw new Error('Clone destination must be an absolute path')
  }

  const repoName = deriveCloneRepoNameFromUrl(args.url)

  const clonePath = join(args.destination, repoName)
  const resolvedDestination = resolve(args.destination)
  const resolvedClonePath = resolve(clonePath)
  const pathFromDestination = relative(resolvedDestination, resolvedClonePath)
  if (
    pathFromDestination === '' ||
    pathFromDestination === '..' ||
    pathFromDestination.startsWith(`..${sep}`) ||
    isAbsolute(pathFromDestination)
  ) {
    throw new Error('Clone path must be inside the destination directory')
  }

  return clonePath

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Resolve the destination against a known base directory (path.resolve) before calling, so it is always absolute.
  2. On non-Windows hosts, reject Windows-style paths at the UI layer and ask for a POSIX path.
  3. Validate the destination is non-empty in the form before submitting the clone request.
  4. If the destination comes from config, store and re-read it as an absolute path.

Example fix

// before
deriveValidatedClonePath({ url, destination: userTypedDest })

// after: absolutize on the host, reject cross-platform shape mismatch
import { resolve, isAbsolute } from 'node:path'
if (!userTypedDest || !isAbsolute(resolve(userTypedDest))) {
  throw new Error('Pick an absolute clone destination folder.')
}
deriveValidatedClonePath({ url, destination: resolve(userTypedDest) })
Defensive patterns

Strategy: validation

Validate before calling

import { isAbsolute, resolve } from 'node:path'
import { isWindowsAbsolutePathLike } from '../../shared/cross-platform-path'

function isValidCloneDestination(destination: string): boolean {
  return Boolean(destination) && isAbsolute(resolve(destination))
    && (process.platform === 'win32' || !isWindowsAbsolutePathLike(destination))
}

if (!isValidCloneDestination(destination)) throw new Error('Clone destination must be an absolute path on this host.')

Type guard

function isCloneDestinationNotAbsolute(error: unknown): boolean {
  return error instanceof Error && error.message === 'Clone destination must be an absolute path'
}

Try / catch

if (!isValidCloneDestination(destination)) {
  showFormError('destination', 'Pick an absolute folder on this host.')
  return
}
try { deriveValidatedClonePath({ url, destination }) }
catch (error) { if (isCloneDestinationNotAbsolute(error)) { showFormError('destination', 'Destination must be absolute.'); return } throw error }

Prevention

When it happens

Trigger: Calling deriveValidatedClonePath({ url, destination }) where destination is '', a relative path like 'repos/foo', undefined, or (on Linux/macOS) a Windows-style path like 'C:\Users\me\repos' or a UNC '\\server\share' that the host OS cannot interpret correctly.

Common situations: A clone form that did not absolutize a user-typed relative path; cross-platform UI bug where a Windows path captured on one host is replayed on another; a destination read from config that was stored as a relative path; an empty form field not caught by the UI before reaching the main process.

Related errors


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