paperclipai/paperclip · error · Error

npm returned an empty version response.

Error message

npm returned an empty version response.

What it means

Sentinel guard in the npm version-output parser: `npm view paperclipai@<spec> version --json` completed but wrote nothing to stdout, so the resolver has no version to pin — typically a transient registry hiccup or an unavailable dist-tag.

Solutions

  1. Retry; if it persists, check npm registry connectivity and the package name.
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at cli/src/commands/install.ts:110 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/0aa1a695169de4a5. Report an issue: GitHub.

Appendix: source

Thrown at cli/src/commands/install.ts:110

export function resolveNpmInstallRequest(options: InstallOptions): {
  spec: string;
  channel: InstallChannel;
} {
  if (options.canary && options.version) throw new Error("Choose either --canary or --version, not both.");
  if (options.version) {
    const version = options.version.trim();
    if (!EXACT_VERSION_PATTERN.test(version)) {
      throw new Error(`--version requires an exact published version, received '${options.version}'.`);
    }
    return { spec: version, channel: "pinned" };
  }
  return options.canary ? { spec: "canary", channel: "canary" } : { spec: "latest", channel: "latest" };
}

function parseResolvedVersion(stdout: string): string {
  const trimmed = stdout.trim();
  if (!trimmed) throw new Error("npm returned an empty version response.");
  try {
    const parsed = JSON.parse(trimmed) as unknown;
    if (typeof parsed === "string") return parsed;
  } catch {
    if (EXACT_VERSION_PATTERN.test(trimmed)) return trimmed;
  }
  throw new Error(`npm returned an unexpected version response: ${trimmed}`);
}

export async function resolvePublishedVersion(spec: string, runCommand: CommandRunner): Promise<string> {
  const result = await runCommand(
    "npm",
    ["view", `paperclipai@${spec}`, "version", "--json", `--registry=${PUBLIC_NPM_REGISTRY}`],
    { maxBuffer: 1024 * 1024 },
  );
  return parseResolvedVersion(result.stdout);
}

View on GitHub (pinned to 01ad858492)