different-ai/openwork · warning · DenApiError

invalid_app_version_payload

invalid_app_version_payload

Error message

App version response was missing version details.

What it means

getAppVersionMetadata fetches /v1/app-version and runs getDenAppVersionMetadata to normalize the payload. If the response lacks version details, a 500 DenApiError with code "invalid_app_version_payload" is thrown. It exists so the app never treats a malformed version response as valid metadata.

Source

Thrown at apps/app/src/app/lib/den.ts:2974

    async getSession(): Promise<DenUser> {
      const payload = await requestJson<unknown>(baseUrls, "/v1/me", {
        method: "GET",
        token,
      });
      const user = getUser(payload);
      if (!user) {
        throw new DenApiError(500, "invalid_session_payload", "Session response did not include a user.");
      }
      return user;
    },

    async getAppVersionMetadata(): Promise<DenAppVersionMetadata> {
      const payload = await requestJson<unknown>(baseUrls, "/v1/app-version", {
        method: "GET",
      });
      const appVersionMetadata = getDenAppVersionMetadata(payload);
      if (!appVersionMetadata) {
        throw new DenApiError(500, "invalid_app_version_payload", "App version response was missing version details.");
      }
      return appVersionMetadata;
    },

    async getDesktopConfig(orgId?: string | null): Promise<DenDesktopConfig> {
      const payload = await requestJson<unknown>(baseUrls, "/v1/me/desktop-config", {
        method: "GET",
        token,
        organizationId: orgId,
      });
      return normalizeDenDesktopConfig(payload);
    },

    async getResourceSnapshot(orgId?: string | null): Promise<DenResourceSnapshot> {
      const payload = await requestJson<unknown>(baseUrls, "/v1/resources", {
        method: "GET",
        token,
        organizationId: orgId,

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Confirm the Den server version supports /v1/app-version with the expected fields
  2. Log the raw payload to diagnose the shape mismatch
  3. Fix baseUrl misconfiguration pointing at the wrong host
  4. Skip/downgrade version-check UX when metadata is unavailable

Example fix

// before
const meta = await client.getAppVersionMetadata();
showUpdateBanner(meta);
// after
try {
  const meta = await client.getAppVersionMetadata();
  showUpdateBanner(meta);
} catch (err) {
  if (err instanceof DenApiError && err.code === "invalid_app_version_payload") return; // skip version check
  throw err;
}
Defensive patterns

Strategy: fallback

Validate before calling

const res = await fetch(`${baseUrl}/v1/app-version`);
if (!res.ok || !(res.headers.get("content-type") ?? "").includes("application/json")) skipVersionCheck();

Type guard

const hasVersionDetails = (v: unknown): v is DenAppVersionMetadata =>
  typeof v === "object" && v !== null && "version" in v && typeof (v as { version: unknown }).version === "string";

Try / catch

let meta: DenAppVersionMetadata | null = null;
try { meta = await client.getAppVersionMetadata(); }
catch (err) {
  if (err instanceof DenApiError && err.code === "invalid_app_version_payload") meta = null;
  else throw err;
}
if (meta) showUpdateBanner(meta);

Prevention

When it happens

Trigger: GET /v1/app-version returns 2xx but the body is missing version fields — wrong server, outdated server build, or a proxy substituting the response.

Common situations: Self-hosted Den deployments running an older version without the app-version endpoint payload, or load balancer health pages returning 200 with HTML.

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/6354b6cfadde6c23. Report an issue: GitHub.