denoland/deno · error

invalid {kind}: name is empty

Error message

invalid {kind}: name is empty

What it means

validate_launcher_name guards every name that gets interpolated into generated launcher scripts (POSIX shell on macOS/Linux, .bat on Windows) — in practice the app name from your desktop config. The first check rejects an empty string before any escaping can be attempted, since an empty launcher name would produce a broken script.

Source

Thrown at cli/tools/desktop.rs:2978

      dir.join("Release/laufey_webview.app"),
      dir.join("webview/Release/laufey_webview.app"),
    ],
    _ => vec![
      dir.join(format!("laufey_{backend}.app")),
      dir.join("laufey.app"),
    ],
  };
  candidates.into_iter().find(|p| p.exists())
}

/// Reject any name we'd interpolate into a generated launcher script
/// (POSIX shell on macOS/Linux, `.bat` on Windows). Even the
/// double-quoted positions take expansions: `$`, backticks, `\` in
/// bash; `%` and `^` in cmd.exe. The launcher kind context (`kind`)
/// is included in the error to make the failure easy to act on.
fn validate_launcher_name(name: &str, kind: &str) -> Result<(), AnyError> {
  if name.is_empty() {
    bail!("invalid {kind}: name is empty");
  }
  // ASCII-only, alphanumerics + a small whitelist of harmless
  // punctuation. Spaces are allowed because real macOS .app bundles
  // commonly have spaces in their executable names.
  let bad = name.chars().find(|c| {
    !(c.is_ascii_alphanumeric() || matches!(c, ' ' | '.' | '_' | '-'))
  });
  if let Some(c) = bad {
    bail!(
      "invalid {kind} {name:?}: must match [A-Za-z0-9 ._-]+, but contains {c:?}",
    );
  }
  Ok(())
}

/// The pieces of `dylib_path` we feed into the bundlers, with proper
/// error messages instead of `unwrap` panics on degenerate inputs like
/// `--output /` or `--output .`.

View on GitHub (pinned to f7822238ca)

Solutions

  1. Set a non-empty app name in the desktop config (e.g. "My App").
  2. If the name comes from a variable in CI, assert the variable is non-empty before invoking deno desktop.

Example fix

// before
"desktop": { "name": "" }

// after
"desktop": { "name": "My App" }
Defensive patterns

Strategy: validation

Validate before calling

if (!config.desktop?.name || config.desktop.name.trim() === "") {
  throw new Error("desktop.name is required and must be non-empty");
}

Type guard

function isValidLauncherName(name: unknown): name is string {
  return typeof name === "string" && name.length > 0;
}

Prevention

When it happens

Trigger: `deno desktop` runs with an app name that resolves to "" — e.g. the name field in the desktop config is present but empty, or a variable feeding it (CI env var, scaffold placeholder) was never filled in.

Common situations: Templated/scaffolded projects where someone left name empty; CI jobs templating deno.json from env vars that are unset.

Related errors


AI-assisted analysis of denoland/deno@f7822238ca (2026-08-20). Data as JSON: /api/errors/d33ff807a7903ddc. Report an issue: GitHub.