denoland/deno · error · TypeError

Unexpected 'name' field in options, bench name is already pr

Error message

Unexpected 'name' field in options, bench name is already provided as the first argument

What it means

`deno desktop` validates configured deep-link URL schemes against the RFC 3986 scheme grammar — it must start with an ASCII letter and contain only letters, digits, `+`, `-`, `.` — and additionally rejects the reserved schemes http, https, file, ftp, ws, and wss, since registering those as app handlers would hijack normal browsing.

Source

Thrown at cli/js/40_bench.js:130

  };

  if (typeof nameOrFnOrOptions === "string") {
    if (!nameOrFnOrOptions) {
      throw new TypeError("The bench name can't be empty");
    }
    if (typeof optionsOrFn === "function") {
      benchDesc = { fn: optionsOrFn, name: nameOrFnOrOptions, ...defaults };
    } else {
      if (!maybeFn || typeof maybeFn !== "function") {
        throw new TypeError("Missing bench function");
      }
      if (optionsOrFn.fn != undefined) {
        throw new TypeError(
          "Unexpected 'fn' field in options, bench function is already provided as the third argument",
        );
      }
      if (optionsOrFn.name != undefined) {
        throw new TypeError(
          "Unexpected 'name' field in options, bench name is already provided as the first argument",
        );
      }
      benchDesc = {
        ...defaults,
        ...optionsOrFn,
        fn: maybeFn,
        name: nameOrFnOrOptions,
      };
    }
  } else if (typeof nameOrFnOrOptions === "function") {
    if (!nameOrFnOrOptions.name) {
      throw new TypeError("The bench function must have a name");
    }
    if (optionsOrFn != undefined) {
      throw new TypeError("Unexpected second argument to Deno.bench()");
    }
    if (maybeFn != undefined) {

View on GitHub (pinned to 89f33cbef2)

Solutions

  1. Use a bare custom scheme starting with a letter, e.g. `myapp` or `com.example.myapp`
  2. Strip `://` and any host/path — pass only the scheme token
  3. Replace invalid characters: underscores become hyphens, no spaces or colons allowed
  4. If you wanted a web-style link, keep using a custom scheme plus your site's handle; do not register reserved schemes

Example fix

// before (desktop config)
"deepLinks": ["https://myapp.example/open"]

// after
"deepLinks": ["myapp"]
Defensive patterns

Strategy: validation

Type guard

const RESERVED = new Set(['http', 'https', 'file', 'ftp', 'ws', 'wss']);
function isValidScheme(s: string): boolean {
  return /^[A-Za-z][A-Za-z0-9+.-]*$/.test(s) && !RESERVED.has(s.toLowerCase());
}

Prevention

When it happens

Trigger: A deep-link scheme entry that is empty, starts with a digit or symbol, contains characters outside ALPHA/DIGIT/`+`/`-`/`.` (space, underscore, colon), or equals one of the reserved schemes.

Common situations: Pasting a full URL (`https://myapp.example`) into a scheme field; using snake_case scheme names; leaving the scheme field empty in generated config; attempting to claim `http`/`ws` for an app.

Related errors


AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16). Data as JSON: /api/errors/e47d0158ca80e4ed. Report an issue: GitHub.