openclaw/openclaw · error · Error

paths required

Error message

paths required

What it means

Thrown by the upload action case when the 'paths' parameter is missing or resolves to an empty array after coercion. The upload action triggers a browser file-chooser dialog and needs at least one file path to upload, so an empty list is rejected before resolveExistingUploadPaths is called (browser-tool.ts:934-938).

Source

Thrown at extensions/browser/src/browser-tool.ts:937

          return {
            content: [{ type: "text" as const, text: `FILE:${result.path}` }],
            details: result,
          };
        }
        case "download":
        case "waitfordownload":
          return await executeDownloadAction({
            action,
            input: params,
            baseUrl,
            profile,
            proxyRequest,
            onTabActivity: sessionTabs.touch,
          });
        case "upload": {
          const paths = Array.isArray(params.paths) ? params.paths.map((p) => String(p)) : [];
          if (paths.length === 0) {
            throw new Error("paths required");
          }
          const resolvedResult = await resolveExistingUploadPaths({ requestedPaths: paths });
          if (!resolvedResult.ok) {
            throw new Error(resolvedResult.error);
          }
          const normalizedPaths = resolvedResult.paths;
          const ref = readStringParam(params, "ref");
          const inputRef = readStringParam(params, "inputRef");
          const element = readStringParam(params, "element");
          const { targetId, timeoutMs } = readOptionalTargetAndTimeout(params);
          const request = {
            paths: normalizedPaths,
            ref,
            inputRef,
            element,
            targetId,
            timeoutMs,
          };

View on GitHub (pinned to 01804a7531)

Solutions

  1. Pass paths as a non-empty array: {"action":"upload","paths":["/abs/path/to/file.pdf"]}.
  2. If paths come from a variable, validate it is a non-empty array before invoking the tool.
  3. Ensure each path is a string; the code does String(p) on each element (browser-tool.ts:935).

Example fix

// before
{ "action": "upload", "paths": [], "ref": "fileInput" }
// after
{ "action": "upload", "paths": ["/tmp/report.pdf"], "ref": "fileInput" }
Defensive patterns

Strategy: validation

Validate before calling

// Validate upload paths before calling the browser tool
function validateUploadArgs(paths) {
  if (!Array.isArray(paths) || paths.length === 0) {
    throw new Error("upload requires a non-empty paths array of strings");
  }
  return paths.map(String);
}

Type guard

function isNonEmptyStringArray(value: unknown): value is string[] {
  return Array.isArray(value) && value.length > 0 && value.every((v) => typeof v === "string");
}

Prevention

When it happens

Trigger: Calling the browser tool with {"action":"upload"} and no paths key, or {"action":"upload","paths":[]}, or {"action":"upload","paths":"single-file"} (a string, not an array, yields an empty array after the Array.isArray check).

Common situations: A model omitting paths because it expects the file chooser to use a clipboard or default. Passing a single path as a string instead of a one-element array. A script that dynamically builds paths and produces an empty array on a filter miss.

Related errors


AI-assisted analysis of openclaw/openclaw@01804a7531 (2026-08-12). Data as JSON: /api/errors/05ac99c34d09cbe0. Report an issue: GitHub.