paperclipai/paperclip · error · Error
Worktree selector cannot be empty.
Error message
Worktree selector cannot be empty.
What it means
Required-argument guard in worktree selector resolution: the selector string is empty after trimming, so there is no path, directory name, branch, or 'current' keyword to resolve a worktree endpoint from.
Solutions
- Pass an absolute or relative path to the worktree root directory
- Pass the worktree directory name under the worktrees home
- Pass the worktree's git branch label
- Pass the literal keyword "current" to target the worktree containing the current directory
- Run paperclipai worktree:list first to see valid selectors
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at cli/src/commands/worktree.ts:2827 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-08-18).
Data as JSON: /api/errors/bd287e603dcd631a.
Report an issue: GitHub.
Appendix: source
Thrown at cli/src/commands/worktree.ts:3642
if (choice.isCurrent) {
return resolveCurrentWorktreeEndpoint();
}
return {
rootPath: choice.worktree,
configPath: path.resolve(choice.worktree, ".paperclip", "config.json"),
label: choice.branchLabel,
isCurrent: false,
};
}
function resolveWorktreeEndpointFromSelector(
selector: string,
opts?: { allowCurrent?: boolean },
): ResolvedWorktreeEndpoint {
const trimmed = selector.trim();
const allowCurrent = opts?.allowCurrent !== false;
if (trimmed.length === 0) {
throw new Error("Worktree selector cannot be empty.");
}
const currentEndpoint = resolveCurrentWorktreeEndpoint();
if (allowCurrent && trimmed === "current") {
return currentEndpoint;
}
const choices = toMergeSourceChoices(process.cwd());
const directPath = path.resolve(trimmed);
if (existsSync(directPath)) {
if (allowCurrent && directPath === currentEndpoint.rootPath) {
return currentEndpoint;
}
const configPath = path.resolve(directPath, ".paperclip", "config.json");
if (!existsSync(configPath)) {
throw new Error(`Resolved worktree path ${directPath} does not contain .paperclip/config.json.`);
}
return {View on GitHub (pinned to 01ad858492)