Hmbown/CodeWhale · error

browser start url must be a string

Error message

browser start url must be a string

What it means

Type guard in resolveTool's browser 'start' case: when a url is supplied it must be a string; any other JS type (number, object, array) is rejected before browser_start is dispatched. A missing url is allowed and starts on the default page.

Solutions

  1. Pass url as a string (or omit it to start on the default page).
  2. Quote/serialize the URL properly when building the request from JSON.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/tui/plugins/computer-use/src/tools.mjs:834 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/e74539487247bb44. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/plugins/computer-use/src/tools.mjs:834

      const foreground = rest.scope === "foreground";
      if (!foreground && rest.app == null && rest.name == null && rest.bundle_id == null && rest.pid == null) {
        throw bad(`consent action "${args.action}" needs an app (name, bundle_id, pid or app string) — or scope:"foreground" for the shared-pointer decision`);
      }
      return { name: wire, args: rest };
    }
    case "key": {
      if (args.duration == null) return { name, args };
      const { duration, repeat, target, ...rest } = args;
      if (repeat != null || target != null) throw bad("key with duration holds the key — repeat and target cannot be combined with it");
      if (!Number.isFinite(duration) || duration < 0.05 || duration > 30) throw bad("duration must be 0.05..30 seconds");
      return { name: "hold_key", args: { ...rest, duration } };
    }
    case "browser": {
      const rest = { ...args };
      delete rest.action;
      switch (args.action) {
        case "start":
          if (rest.url != null && typeof rest.url !== "string") throw bad("browser start url must be a string");
          return { name: "browser_start", args: rest };
        case "status": return { name: "browser_status", args: rest };
        case "navigate":
          if (typeof rest.url !== "string" || !rest.url.trim()) throw bad('browser action "navigate" requires url');
          return { name: "browser_navigate", args: rest };
        case "click": {
          const hasSelector = typeof rest.selector === "string" && rest.selector.trim();
          const hasPoint = rest.point != null && Number.isFinite(rest.point?.x) && Number.isFinite(rest.point?.y);
          if (hasSelector && hasPoint) throw bad('browser action "click" takes selector or point, not both — pick one target');
          if (!hasSelector && !hasPoint) throw bad('browser action "click" needs selector (CSS) or point {x,y}');
          if (!hasSelector) delete rest.selector;
          if (!hasPoint) delete rest.point;
          return { name: "browser_click", args: rest };
        }
        case "type":
          if (typeof rest.text !== "string" || !rest.text.length) throw bad('browser action "type" requires text');
          return { name: "browser_type", args: rest };
        case "screenshot": return { name: "browser_screenshot", args: rest };

View on GitHub (pinned to 73e0f67d83)