denoland/deno · error
bundle identifier {id:?} has an empty segment
Error message
bundle identifier {id:?} has an empty segment What it means
Thrown by validate_bundle_identifier in deno desktop's macOS bundling path. After checking the identifier's overall charset, the validator splits it on '.' and rejects any identifier containing an empty segment (leading dot, trailing dot, or consecutive dots). Empty segments produce a malformed CFBundleIdentifier that macOS codesigning, Launch Services, and CEF helper-process matching all mishandle.
Source
Thrown at cli/tools/desktop.rs:2484
// Apple's documented limit for CFBundleIdentifier on receipts is
// 155 chars; bigger values quietly truncate elsewhere in the
// toolchain.
bail!("bundle identifier {id:?} is longer than 155 characters");
}
if !id.contains('.') {
bail!(
"bundle identifier {id:?} must be in reverse-DNS form (e.g. com.acme.foo)"
);
}
for c in id.chars() {
if !(c.is_ascii_alphanumeric() || c == '.' || c == '-') {
bail!(
"bundle identifier {id:?} must match [A-Za-z0-9.-]+, but contains {c:?}",
);
}
}
if id.split('.').any(|seg| seg.is_empty()) {
bail!("bundle identifier {id:?} has an empty segment");
}
Ok(())
}
/// Walk every `.app` under `Contents/Frameworks/` and rewrite its
/// `CFBundleIdentifier` so it's a strict suffix of `main_bundle_id`.
///
/// CEF's process model: when the browser process spawns a helper for a
/// child role (gpu, renderer, plugin, …), the helper inspects its own
/// `CFBundleIdentifier` and refuses to attach to a parent whose id
/// doesn't match it as a prefix. laufey's default helper plists ship with
/// `com.example.laufey.helper.*` — which is inconsistent with whatever id
/// we wrote into the main bundle, so we'd get a launch-time refusal
/// (the helper exits silently and the browser hangs waiting for it).
///
/// We compute the new id by extracting the "kind" suffix from the
/// existing id (everything from the last `helper` segment onward) and
/// concatenating it onto the main id. So `com.example.laufey.helper` →View on GitHub (pinned to f7822238ca)
Solutions
- Edit the identifier to have non-empty dot-separated segments, e.g. 'com.acme.app' — no leading, trailing, or double dots.
- If the id is assembled from parts (org, product, suffix), assert each part is non-empty before joining with '.'.
- Keep segments to ASCII alphanumerics and '-' so the earlier charset check also passes.
Example fix
// deno.json (desktop config) — before
{
"desktop": { "identifier": "com.acme." } }
// after
{
"desktop": { "identifier": "com.acme.app" } } Defensive patterns
Strategy: validation
Validate before calling
// Run before `deno desktop` (e.g. in a prebuild script)
function assertBundleId(id: string): void {
if (!/^[A-Za-z0-9.-]+$/.test(id)) throw new Error(`bad charset: ${id}`);
if (id.split(".").some((seg) => seg.length === 0)) {
throw new Error(`bundle identifier '${id}' has an empty segment`);
}
}
assertBundleId(config.desktop.identifier); Type guard
function isValidBundleId(id: string): boolean {
return /^[A-Za-z0-9.-]+$/.test(id) && !id.split(".").some((s) => s === "");
} Prevention
- Derive the bundle id from fixed constants, never from string-joining unchecked variables.
- Add a config lint step in CI that runs the segment check before any desktop build.
- Include one golden identifier (com.example.app) in the project README next to the config key.
When it happens
Trigger: Running `deno desktop` with a configured bundle identifier (via the desktop identifier flag/config) whose dotted form has an empty segment: '.com.acme.app', 'com.acme.', or 'com..acme'. The charset check ([A-Za-z0-9.-]) passes for these, so this segment check is what catches them.
Common situations: Hand-typed identifiers with a typo, identifiers assembled by joining variables where one variable is an empty string, or a trailing dot copy-pasted from a sentence like 'our id is com.acme.foo.'.
Related errors
- bundle identifier {id:?} is longer than 155 characters
- CFBundleIdentifier is empty in {}
- icon sets are not supported in --hmr mode yet
- icon '{}' not found
- icon '{}' must be .icns or .png
AI-assisted analysis of denoland/deno@f7822238ca (2026-08-20).
Data as JSON: /api/errors/83151c9498f4b432.
Report an issue: GitHub.