paperclipai/paperclip · error · Error

Resolved worktree path

Error message

Resolved worktree path ${directPath} does not contain .paperclip/config.json.

What it means

Identity guard in worktree endpoint resolution: the selector resolved to an existing directory, but that directory lacks a .paperclip/config.json, so it is not a Paperclip-managed worktree and cannot serve as a merge/reseed endpoint.

Solutions

  1. Point the selector at a directory that contains .paperclip/config.json.
  2. Run `paperclipai worktree:init` in ${directPath} to create the config first.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cli/src/commands/worktree.ts:2843 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/2742d0014ff88879. Report an issue: GitHub.

Appendix: source

Thrown at cli/src/commands/worktree.ts:3658

  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 {
      rootPath: directPath,
      configPath,
      label: path.basename(directPath),
      isCurrent: false,
    };
  }

  const matched = choices.find((choice) =>
    (allowCurrent || !choice.isCurrent)
    && (choice.worktree === directPath
      || path.basename(choice.worktree) === trimmed
      || choice.branchLabel === trimmed),
  );
  if (!matched) {
    throw new Error(
      `Could not resolve worktree "${selector}". Use a path, a listed worktree directory name, branch name, or "current".`,

View on GitHub (pinned to 01ad858492)