{"record":{"id":"f3e488748caa4c94","repo":"different-ai/openwork","slug":"latest-mac-yml-is-missing-version","errorCode":null,"errorMessage":"latest-mac.yml is missing version.","messagePattern":"latest-mac\\.yml is missing version\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/app/src/app/lib/electron-alpha.ts","lineNumber":48,"sourceCode":"  if (!match?.[1]) return null;\n  return match[1].trim().replace(/^['\"]|['\"]$/g, \"\");\n}\n\nfunction resolveArtifactUrl(pathOrUrl: string): string {\n  if (/^https:\\/\\//i.test(pathOrUrl)) return pathOrUrl;\n  return new URL(pathOrUrl, `${ELECTRON_ALPHA_RELEASE_BASE_URL}/`).toString();\n}\n\nexport function parseElectronLatestMacYml(\n  raw: string,\n  arch: \"arm64\" | \"x64\",\n): ElectronAlphaArtifact {\n  const version = parseYamlScalar(raw, \"version\");\n  const path = parseYamlScalar(raw, \"path\") ?? parseFirstFileUrl(raw);\n  const sha512 = parseYamlScalar(raw, \"sha512\");\n\n  if (!version) {\n    throw new Error(\"latest-mac.yml is missing version.\");\n  }\n  if (!path) {\n    throw new Error(\"latest-mac.yml is missing artifact path/url.\");\n  }\n  if (!sha512) {\n    throw new Error(\"latest-mac.yml is missing sha512.\");\n  }\n\n  return {\n    arch,\n    manifestUrl: ELECTRON_ALPHA_LATEST_MAC_YML_URL,\n    releaseUrl: ELECTRON_ALPHA_RELEASE_PAGE_URL,\n    url: resolveArtifactUrl(path),\n    path,\n    version,\n    sha512,\n  };\n}","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/app/src/app/lib/electron-alpha.ts#L30-L66","documentation":"parseElectronLatestMacYml performs a minimal parse of the auto-update metadata file latest-mac.yml (emitted by electron-builder for macOS updates). The `version` field is mandatory because it identifies the release being downloaded and verified; when it is absent the function throws this explicit message rather than proceeding with an unusable artifact descriptor.","triggerScenarios":"resolveElectronAlphaArtifact fetching latest-mac.yml content where parseYamlScalar(raw, \"version\") returns empty — the file is truncated, an HTML error page was served instead of YAML (bad CDN/proxy), a manually edited feed dropped the version key, or a partially-written upload.","commonSituations":"A release pipeline that uploaded the mac zip but published a broken/empty latest-mac.yml; a proxy or misconfigured static host returning an HTML 404 page whose 'version:' scalar parses to nothing; hand-edited alpha update feeds on a self-hosted server; network middleware stripping the file body.","solutions":["Regenerate and re-upload latest-mac.yml from the electron-builder release output for the affected macOS build (do not hand-edit it).","Verify the URL actually serves the YAML: `curl -s <url>/latest-mac.yml | head` — if you get HTML, fix the CDN/host path or release channel URL.","If the feed is self-hosted, re-run the publish step (electron-builder --publish) so version/path/sha512 are all written together.","Add a pre-flight check in the fetcher: validate the response content-type/first line before passing the body to parseElectronLatestMacYml to get a clearer error."],"exampleFix":"// before\nconst artifact = resolveElectronAlphaArtifact(await res.text());\n\n// after\nconst body = await res.text();\nif (!res.ok || !/^version:/m.test(body)) {\n  throw new Error(`latest-mac.yml fetch invalid (HTTP ${res.status})`);\n}\nconst artifact = resolveElectronAlphaArtifact(body);","handlingStrategy":"validation","validationCode":"const res = await fetch(latestMacYmlUrl);\nconst body = await res.text();\nif (!res.ok || !/^version:\\s*\\S+/m.test(body)) {\n  throw new Error(`Invalid latest-mac.yml at ${latestMacYmlUrl} (HTTP ${res.status})`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  resolveElectronAlphaArtifact(body);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith(\"latest-mac.yml is missing\")) {\n    await reFetchAndVerifyUpdateFeed(); // regenerate/re-download the manifest\n  } else { throw err; }\n}","preventionTips":["Never hand-edit latest-mac.yml; always publish it via electron-builder.","Verify update-feed URLs return YAML (not HTML error pages) after CDN/proxy changes.","Upload version, path, and sha512 fields together in the release pipeline.","Pre-validate fetched manifests for required keys before parsing into artifacts."],"tags":["auto-update","yaml-parsing","release-pipeline","electron"],"backgroundTag":"update-manifest-missing-field","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}