paperclipai/paperclip · critical · Error

Refusing to use unrecognized install store ${paths.cliRoot}.

Error message

Refusing to use unrecognized install store ${paths.cliRoot}.

What it means

Thrown by initializeInstallStore() when the marker file exists, is a valid regular file owned by the current user, but its contents do not equal the expected MANAGED_STORE_MARKER constant ('paperclipai managed install store v1\n'). This means the directory is a real directory but is not a Paperclip-managed install store — overwriting it could destroy unrelated data.

Source

Thrown at cli/src/install-store.ts:99

    manifestPath: path.join(cliRoot, "install.json"),
    markerPath: path.join(cliRoot, ".managed-install"),
    lockPath: path.join(cliRoot, ".install.lock"),
    currentPath: path.join(cliRoot, "current"),
    shimPath: path.join(homeDir, ".local", "bin", "paperclipai"),
  };
}

export function initializeInstallStore(paths = resolveInstallStorePaths()): void {
  ensurePrivateDirectory(paths.cliRoot);
  ensurePrivateDirectory(paths.installsRoot);
  try {
    const markerStat = fs.lstatSync(paths.markerPath);
    if (!markerStat.isFile() || markerStat.isSymbolicLink() || markerStat.nlink > 1) {
      throw new Error(`Refusing to use unsafe install-store marker ${paths.markerPath}.`);
    }
    assertOwnedByCurrentUser(markerStat, paths.markerPath);
    if (fs.readFileSync(paths.markerPath, "utf8") !== MANAGED_STORE_MARKER) {
      throw new Error(`Refusing to use unrecognized install store ${paths.cliRoot}.`);
    }
  } catch (error) {
    if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error;
    try {
      fs.writeFileSync(paths.markerPath, MANAGED_STORE_MARKER, { mode: 0o600, flag: "wx" });
    } catch (writeError) {
      if (
        (writeError as NodeJS.ErrnoException).code !== "EEXIST" ||
        fs.readFileSync(paths.markerPath, "utf8") !== MANAGED_STORE_MARKER
      ) {
        throw writeError;
      }
    }
  }
}

export function assertManagedInstallStore(paths = resolveInstallStorePaths()): InstallManifest {
  const cliStat = fs.lstatSync(paths.cliRoot);

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Verify the path is intended to be a Paperclip install store; if it holds unrelated data, move it aside or repoint PAPERCLIP_HOME.
  2. If the directory is a stale or abandoned store, remove it entirely ('rm -rf ~/.paperclip/cli') and let the CLI initialize a fresh one.
  3. If this is a version mismatch, consult the upgrade/migration notes for the Paperclip version in use.
  4. Do not manually rewrite the marker unless you understand the store layout — prefer removing and re-initializing.

Example fix

$ cat ~/.paperclip/cli/.managed-install
something-else
$ rm -rf ~/.paperclip/cli
$ paperclipai install   # initializes fresh store with correct marker
Defensive patterns

Strategy: try-catch

Validate before calling

import fs from "node:fs";
import { resolveInstallStorePaths, MANAGED_STORE_MARKER } from "./install-store.js";

function isRecognizedStore(paths = resolveInstallStorePaths()): boolean {
  try {
    return fs.readFileSync(paths.markerPath, "utf8") === MANAGED_STORE_MARKER;
  } catch { return false; }
}

Type guard

import fs from "node:fs";
import { MANAGED_STORE_MARKER } from "./install-store.js";

function hasValidMarker(markerPath: string): boolean {
  try { return fs.readFileSync(markerPath, "utf8") === MANAGED_STORE_MARKER; }
  catch { return false; }
}

Try / catch

try {
  initializeInstallStore(paths);
} catch (err) {
  if (err instanceof Error && err.message.includes("unrecognized install store")) {
    console.error(`${paths.cliRoot} is not a Paperclip store. Remove it or set PAPERCLIP_HOME.`);
    process.exit(1);
  }
  throw err;
}

Prevention

When it happens

Trigger: Called initializeInstallStore() on a cliRoot that contains a .managed-install file with unexpected contents (different marker string, empty, or garbage).

Common situations: 1) The path ~/.paperclip/cli was reused for a different purpose or a different product that also uses a marker file. 2) A different Paperclip major version wrote a different marker string. 3) The marker was truncated or rewritten by an editor. 4) PAPERCLIP_HOME was pointed at a non-Paperclip directory.

Related errors


AI-assisted analysis of paperclipai/paperclip@67001ec6eb (2026-08-12). Data as JSON: /api/errors/11131daabd773e19. Report an issue: GitHub.