{"record":{"id":"e0cd26a7a8a15d2a","repo":"denoland/deno","slug":"bundle-identifier-id-is-longer-than-155-charac","errorCode":null,"errorMessage":"bundle identifier {id:?} is longer than 155 characters","messagePattern":"bundle identifier (.+?) is longer than 155 characters","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/tools/desktop.rs","lineNumber":2469,"sourceCode":"/// Validate a reverse-DNS bundle identifier (Apple `CFBundleIdentifier`,\n/// also used for Linux `.desktop` filenames and Windows AppUserModelID).\n///\n/// Apple's rules: ASCII alphanumerics, hyphens, and dots; must have at\n/// least one dot (so it looks like reverse DNS); each dot-separated\n/// segment must be non-empty and not start with a digit. We don't\n/// enforce the segment-leading-letter rule strictly (some legacy apps\n/// use digits) but we do reject empty segments and obvious shell\n/// metacharacters — the identifier ends up as a `codesign` argument and\n/// a path component of the helper bundles.\nfn validate_bundle_identifier(id: &str) -> Result<(), AnyError> {\n  if id.is_empty() {\n    bail!(\"bundle identifier is empty\");\n  }\n  if id.len() > 155 {\n    // Apple's documented limit for CFBundleIdentifier on receipts is\n    // 155 chars; bigger values quietly truncate elsewhere in the\n    // toolchain.\n    bail!(\"bundle identifier {id:?} is longer than 155 characters\");\n  }\n  if !id.contains('.') {\n    bail!(\n      \"bundle identifier {id:?} must be in reverse-DNS form (e.g. com.acme.foo)\"\n    );\n  }\n  for c in id.chars() {\n    if !(c.is_ascii_alphanumeric() || c == '.' || c == '-') {\n      bail!(\n        \"bundle identifier {id:?} must match [A-Za-z0-9.-]+, but contains {c:?}\",\n      );\n    }\n  }\n  if id.split('.').any(|seg| seg.is_empty()) {\n    bail!(\"bundle identifier {id:?} has an empty segment\");\n  }\n  Ok(())\n}","sourceCodeStart":2451,"sourceCodeEnd":2487,"githubUrl":"https://github.com/denoland/deno/blob/f7822238cab635a3a19f99f493f675fa81a7f9d8/cli/tools/desktop.rs#L2451-L2487","documentation":"Thrown by validate_bundle_identifier when `--identifier` exceeds 155 characters. 155 is Apple's documented limit for CFBundleIdentifier on receipts; longer values are silently truncated elsewhere in the toolchain (codesign, helpers), so Deno rejects them up front instead of letting later steps fail obscurely.","triggerScenarios":"Programmatically generated identifiers that embed long paths, hashes, or CI job names (e.g. com.acme.ci.build.${sha256...}); concatenating extra suffixes onto an already-long company identifier.","commonSituations":"CI pipelines appending commit SHAs or branch slugs to the base id; deep corporate reverse-DNS prefixes plus descriptive app names crossing the limit; identifier assembled from several config fields without a length check.","solutions":["Shorten to ≤155 characters — drop appended hashes/branch names that do not need to be in the id.","Keep the stable part (`com.acme.myapp`) and move build metadata elsewhere (version, build files), not into CFBundleIdentifier.","Add a length assertion in the script that generates the identifier."],"exampleFix":"# before\ndeno desktop --identifier \"com.acme.enterprise.division.platform.teams.desktop.ci.build.a1b2c3d4e5f6...\" main.ts\n\n# after\ndeno desktop --identifier \"com.acme.teams.desktop\" main.ts","handlingStrategy":"validation","validationCode":"# bash: cap generated identifiers\nBUNDLE_ID=\"com.acme.teams.desktop${SUFFIX:+-$SUFFIX}\"\n(( ${#BUNDLE_ID} <= 155 )) || { echo \"identifier too long (${#BUNDLE_ID})\" >&2; exit 1; }\ndeno desktop --identifier \"$BUNDLE_ID\" main.ts","typeGuard":"// TypeScript\nfunction isWithinBundleIdLengthLimit(id: string): boolean {\n  return id.length <= 155;\n}","tryCatchPattern":null,"preventionTips":["Keep build metadata (SHAs, branches) out of CFBundleIdentifier.","Assert length at identifier-generation time in CI scripts.","Remember notification/TCC grants key off the id — it should be stable and short."],"tags":["desktop","bundle-identifier","validation","length-limit","macos"],"backgroundTag":"invalid-bundle-identifier","analyzedSha":"f7822238cab635a3a19f99f493f675fa81a7f9d8","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}