Skip to content

DTK0029: Path Outside Workspace Root (Open in Finder)

Package: @vitejs/devtools

Message

Path is outside the workspace root

Cause

The vite:core:open-in-finder RPC function received a file path that, when resolved against the workspace root, points to a location outside the workspace root directory. This is a security restriction to prevent the DevTools client from opening arbitrary directories or files in the system file manager. The check resolves the path using path.resolve() and then verifies that the relative path from the workspace root does not start with .. and does not contain null bytes.

Example

ts
// From the DevTools client, calling the open-in-finder RPC
await rpc.call('vite:core:open-in-finder', '../../../home')
// Throws DTK0029 because the path escapes the workspace root

await rpc.call('vite:core:open-in-finder', '/tmp/some-directory')
// Throws DTK0029 if /tmp is not within the workspace root

Fix

Ensure the path passed to the open-in-finder function is within the workspace root. Use relative paths from the project root, or absolute paths that resolve to a location inside the workspace.

ts
// Use a relative path within the project
await rpc.call('vite:core:open-in-finder', 'src/components')

// Or an absolute path that is inside the workspace root
await rpc.call('vite:core:open-in-finder', '/workspace/project/public/assets')

If you need to open locations outside the workspace, this is intentionally disallowed for security. The workspace root is determined by context.workspaceRoot.

Source

packages/core/src/node/rpc/public/open-in-finder.ts

Released under the MIT License.