stablyai/orca · error · Error
Access denied: unknown repository or worktree path
Error message
Access denied: unknown repository or worktree path
What it means
Thrown by `resolveRegisteredWorktreePath` after all resolution attempts fail: the resolved target is neither in the `registeredWorktreeRoots` set, a repo root, nor normalizes (via `normalizeExistingPath`) to a registered root. Linked worktrees are trusted only when they appear in `git worktree list` registration, not by directory containment, so an unregistered path is rejected even if it looks like a worktree.
Source
Thrown at src/main/ipc/filesystem-auth.ts:434
if (registeredWorktreeRoots.has(resolvedTarget) || isRepoRoot(store.getRepos(), resolvedTarget)) {
return resolvedTarget
}
if (registeredWorktreeRootsDirty) {
await ensureAuthorizedRootsCache(store)
}
if (registeredWorktreeRoots.has(resolvedTarget)) {
return resolvedTarget
}
// Resolve symlinks only after the cheap registered-root check: on macOS realpath() can trigger TCC prompts.
const normalizedTarget = await normalizeExistingPath(resolvedTarget)
if (registeredWorktreeRoots.has(normalizedTarget)) {
return normalizedTarget
}
throw new Error('Access denied: unknown repository or worktree path')
}
function refreshRegisteredWorktreeRoots(): void {
registeredWorktreeRoots.clear()
for (const roots of registeredWorktreeRootsByRepo.values()) {
for (const root of roots) {
registeredWorktreeRoots.add(root)
}
}
}
function allLocalRepoRootsRegistered(localRepoIds: Set<string>): boolean {
for (const repoId of localRepoIds) {
if (!registeredWorktreeRootRepoIds.has(repoId)) {
return false
}
}
return trueView on GitHub (pinned to 1136503c6a)
Solutions
- Register the worktree with git from its owning repo (`git worktree add`) so it appears in `git worktree list`.
- Call `invalidateAuthorizedRootsCache()` after worktree registration changes, then retry.
- Pass the worktree root, not a subdirectory; resolve the root first if you hold a child path.
Example fix
// before await resolveRegisteredWorktreePath(childPathInsideWorktree, store) // after const root = await resolveWorktreeRoot(childPathInsideWorktree) invalidateAuthorizedRootsCache() await resolveRegisteredWorktreePath(root, store)
Defensive patterns
Strategy: validation
Validate before calling
// Confirm the path is a registered worktree root or repo root before resolving.
import { isRepoRoot } from '../repo-worktrees'
invalidateAuthorizedRootsCache() // pick up recent registrations
await ensureAuthorizedRootsCache(store)
if (!registeredWorktreeRoots.has(resolve(worktreePath)) && !isRepoRoot(store.getRepos(), resolve(worktreePath))) {
// not registered; register via `git worktree add` or pick a registered root
return null
}
await resolveRegisteredWorktreePath(worktreePath, store) Type guard
function isRegisteredRoot(p: string, set: Set<string>, repos: Repo[]): boolean {
return set.has(p) || isRepoRoot(repos, p)
} Try / catch
try {
return await resolveRegisteredWorktreePath(worktreePath, store)
} catch (e) {
if (e instanceof Error && e.message === 'Access denied: unknown repository or worktree path') {
// path is not a git-registered worktree; register it or pass its root
throw new UnregisteredWorktreeError(e.message)
}
throw e
} Prevention
- Pass the worktree root, not a subdirectory; resolve the root first.
- Run `git worktree list` (or invalidateAuthorizedRootsCache) after adding/removing worktrees.
- Remember linked worktrees are trusted by registration, not by directory containment.
When it happens
Trigger: Calling `resolveRegisteredWorktreePath(worktreePath, store)` with a path that is not the root of any repo and not a worktree registered via `git worktree list` for any known repo.
Common situations: Worktree was created outside Orca and never registered; worktree was deleted/moved and its registration removed between listing and resolution; path points at a subdirectory of a worktree rather than its root; cache is dirty and `ensureAuthorizedRootsCache` did not pick up the repo.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- Access denied: git file path escapes the selected worktree
- Access denied: path resolves outside allowed directories. If
- Access denied: invalid worktree path
- Access denied: invalid git file path
- No worktrees on environment ${envName}
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/ec701e99a56cecb1.
Report an issue: GitHub.