different-ai/openwork · error

Desktop version metadata was incomplete.

Error message

Desktop version metadata was incomplete.

What it means

After an ok response from /v1/app-version, loadDesktopVersionOptions runs getDesktopVersionMetadata on the payload; if it cannot extract the expected metadata shape, this error is thrown. It distinguishes a well-formed HTTP response from one whose body lacks the required version fields.

Source

Thrown at ee/apps/den-web/app/(den)/dashboard/_components/org-settings-screen.tsx:322

      try {
        const { response, payload } = await requestJson(
          "/v1/app-version",
          { method: "GET" },
          12000,
        );

        if (!response.ok) {
          throw new Error(
            getErrorMessage(
              payload,
              `Failed to load desktop version metadata (${response.status}).`,
            ),
          );
        }

        const metadata = getDesktopVersionMetadata(payload);
        if (!metadata) {
          throw new Error("Desktop version metadata was incomplete.");
        }

        if (cancelled) {
          return;
        }

        setDesktopVersionOptions(metadata.publishedDesktopVersions);
        setDesktopVersionRange({
          minVersion: metadata.minAppVersion,
          maxVersion: metadata.latestAppVersion,
        });
      } catch (error) {
        if (!cancelled) {
          setDesktopVersionOptions([]);
          setDesktopVersionRange(null);
          setDesktopVersionOptionsError(
            error instanceof Error
              ? error.message

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Log the raw payload and compare it with what getDesktopVersionMetadata expects (field names/types)
  2. Align frontend and server versions — redeploy the side that is behind
  3. Bypass proxies/CDN for this route to rule out body rewriting
  4. Add unit coverage for getDesktopVersionMetadata against the actual server payload

Example fix

// before
const metadata = getDesktopVersionMetadata(payload);
if (!metadata) {
  throw new Error("Desktop version metadata was incomplete.");
}
// after
const metadata = getDesktopVersionMetadata(payload);
if (!metadata) {
  console.error('app-version payload', payload);
  throw new Error(`Desktop version metadata was incomplete: ${JSON.stringify(payload).slice(0, 200)}`);
}
Defensive patterns

Strategy: validation

Validate before calling

function looksLikeVersionMetadata(payload: unknown): boolean {
  return isRecord(payload) && isRecord(payload.metadata) && typeof payload.metadata.latestVersion === 'string';
}
// if false, fall back to defaults instead of throwing

Type guard

const isDesktopVersionMetadata = (p: unknown): p is { metadata: Record<string, unknown> } =>
  isRecord(p) && isRecord(p.metadata);

Try / catch

try {
  const metadata = getDesktopVersionMetadata(payload);
  if (!metadata) throw new Error('Desktop version metadata was incomplete.');
} catch (err) {
  console.warn('app-version metadata unusable, using defaults', payload);
  applyDefaultVersionOptions();
}

Prevention

When it happens

Trigger: Server returned 200 but the body is missing or malformed version metadata (e.g. null metadata, wrong field names after an API change, an empty JSON object, or a proxy-inserted body).

Common situations: Version skew between web app and den-api after the metadata schema changed; partial deploy where the endpoint exists but returns a stub body; custom middleware returning an empty 200 on the version route.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/22c39cd3c278bc8a. Report an issue: GitHub.