paperclipai/paperclip · error

version must be a string if provided

Error message

version must be a string if provided

What it means

400 validation guard on POST /plugins/install. Fires when a version was supplied in the body but it is not a string (e.g. number); version must be a plain string to be passed to the plugin loader.

Source

Thrown at server/src/routes/plugins.ts:1153

   *
   * Errors:
   * - `400` — validation failure or install error (package not found, bad manifest, etc.)
   * - `403` — install source not permitted on a cloud-managed instance
   * - `500` — installation succeeded but manifest is missing (indicates a loader bug)
   */
  router.post("/plugins/install", async (req, res) => {
    assertInstanceAdmin(req);
    assertPluginManagementVisible();
    const { packageName, version, isLocalPath } = req.body as PluginInstallRequest;

    // Input validation
    if (!packageName || typeof packageName !== "string") {
      res.status(400).json({ error: "packageName is required and must be a string" });
      return;
    }

    if (version !== undefined && typeof version !== "string") {
      res.status(400).json({ error: "version must be a string if provided" });
      return;
    }

    if (isLocalPath !== undefined && typeof isLocalPath !== "boolean") {
      res.status(400).json({ error: "isLocalPath must be a boolean if provided" });
      return;
    }

    // Validate package name format
    const trimmedPackage = packageName.trim();
    if (trimmedPackage.length === 0) {
      res.status(400).json({ error: "packageName cannot be empty" });
      return;
    }

    // Basic security check for package name (prevent injection)
    if (!isLocalPath && /[<>:"|?*]/.test(trimmedPackage)) {
      res.status(400).json({ error: "packageName contains invalid characters" });

View on GitHub (pinned to a7e689b3c3)

Solutions

  1. Fix the offending parameter to satisfy the constraint stated in the error message (type, range, or allowed values), then retry.
  2. Refer to the route's request validation in the named file and the shared validators for the accepted format.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/src/routes/plugins.ts:1137 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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