paperclipai/paperclip · error · Error

Decision signing key at ${keyPath} must be a regular file

Error message

Decision signing key at ${keyPath} must be a regular file

What it means

Filetype guard in enforceKeyFilePermissions: lstat shows the decision-signing key path is not a regular file (symlink, directory, device, etc.). Secret material must be a plain file so ownership/permission checks are meaningful; re-checked again after a chmod attempt.

Source

Thrown at server/src/services/decision-signing.ts:25

const MIN_SECRET_LENGTH = 32;

function resolveGeneratedSecretFilePath() {
  return path.join(path.dirname(resolveDefaultSecretsKeyFilePath()), "decision-signing.key");
}

function assertOwnedByCurrentUser(stats: Stats, description: string) {
  if (process.platform === "win32") return;

  const currentUserId = process.getuid?.();
  if (currentUserId !== undefined && stats.uid !== currentUserId) {
    throw new Error(`${description} must be owned by the Paperclip process user`);
  }
}

function enforceKeyFilePermissions(keyPath: string) {
  let stats = lstatSync(keyPath);
  if (!stats.isFile()) {
    throw new Error(`Decision signing key at ${keyPath} must be a regular file`);
  }
  assertOwnedByCurrentUser(stats, `Decision signing key at ${keyPath}`);
  if (process.platform === "win32") return;

  const mode = stats.mode & 0o777;
  if ((mode & 0o077) !== 0) {
    chmodSync(keyPath, 0o600);
    stats = lstatSync(keyPath);
    if (!stats.isFile()) {
      throw new Error(`Decision signing key at ${keyPath} must be a regular file`);
    }
    assertOwnedByCurrentUser(stats, `Decision signing key at ${keyPath}`);
    if ((stats.mode & 0o077) !== 0) {
      throw new Error(`Decision signing key at ${keyPath} must have permissions 0600`);
    }
  }
}

View on GitHub (pinned to 120ae5428f)

Solutions

  1. Ensure the decision signing key path points to a regular file, not a directory or symlink.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/src/services/decision-signing.ts:25 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@120ae5428f (2026-08-18). Data as JSON: /api/errors/20302282211e3bee. Report an issue: GitHub.