{"record":{"id":"6d87ee0c2a8fdcf8","repo":"different-ai/openwork","slug":"invalid-marketplace-payload","errorCode":"invalid_marketplace_payload","errorMessage":"Marketplace response was missing plugin details.","messagePattern":"Marketplace response was missing plugin details\\.","errorType":"error_code","errorClass":"DenApiError","httpStatus":500,"severity":"error","filePath":"apps/app/src/app/lib/den.ts","lineNumber":3450,"sourceCode":"\n    async listMeLibraryPlugins(orgId: string): Promise<DenMeLibraryPlugin[]> {\n      const payload = await requestJson<unknown>(\n        baseUrls,\n        \"/v1/me/library\",\n        { method: \"GET\", token, organizationId: orgId },\n      );\n      return getMeLibraryPlugins(payload);\n    },\n\n    async getOrgMarketplaceResolved(orgId: string, marketplaceId: string): Promise<DenOrgMarketplaceResolved> {\n      const payload = await requestJson<unknown>(\n        baseUrls,\n        `/v1/marketplaces/${encodeURIComponent(marketplaceId)}/resolved`,\n        { method: \"GET\", token, organizationId: orgId },\n      );\n      const resolved = getOrgMarketplaceResolved(payload);\n      if (!resolved) {\n        throw new DenApiError(500, \"invalid_marketplace_payload\", \"Marketplace response was missing plugin details.\");\n      }\n      return resolved;\n    },\n\n    async getOrgPluginResolved(orgId: string, plugin: DenOrgPlugin): Promise<DenOrgPluginResolved> {\n      const payload = await requestJson<unknown>(\n        baseUrls,\n        `/v1/plugins/${encodeURIComponent(plugin.id)}/resolved`,\n        { method: \"GET\", token, organizationId: orgId },\n      );\n      return getOrgPluginResolved(plugin, payload);\n    },\n\n    async createOrgPlugin(\n      orgId: string,\n      input: {\n        name: string;\n        description?: string | null;","sourceCodeStart":3432,"sourceCodeEnd":3468,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/app/src/app/lib/den.ts#L3432-L3468","documentation":"DenApiError thrown by getOrgMarketplaceResolved in apps/app/src/app/lib/den.ts when GET /v1/marketplaces/{marketplaceId}/resolved returned 2xx but getOrgMarketplaceResolved could not extract the resolved marketplace with its plugin details from the payload. It guards callers against a marketplace object missing plugins/components or being structurally wrong.","triggerScenarios":"The /resolved endpoint responds 200 with null/empty data (marketplace empty or unpublished), the body lacks the plugin detail fields the parser requires, or the server's resolved-marketplace schema differs from what this client version expects.","commonSituations":"Self-hosted Den server running an older schema for /v1/marketplaces/:id/resolved; a marketplace that exists but has no published plugins yet; wrong marketplaceId in a saved config resolving to a stub; a proxy caching or mangling the response.","solutions":["Inspect the raw JSON from /v1/marketplaces/:id/resolved and compare with the fields getOrgMarketplaceResolved expects","Verify the marketplaceId belongs to the org and has published plugins (check via /v1/marketplaces?status=active)","Align server and client versions — a resolved-schema drift means upgrade one side","Bypass any caching proxy to rule out a stale/mangled cached body","Re-fetch after re-authenticating if the response could be a limited-permission stub"],"exampleFix":"// before\nconst resolved = getOrgMarketplaceResolved(payload);\nif (!resolved) {\n  throw new DenApiError(500, \"invalid_marketplace_payload\", \"Marketplace response was missing plugin details.\");\n}\n// after\ncaller-side guard:\ntry {\n  const resolved = await client.getOrgMarketplaceResolved(orgId, marketplaceId);\n} catch (err) {\n  if (err instanceof DenApiError && err.code === \"invalid_marketplace_payload\") {\n    // fall back to listOrgMarketplaces to verify the marketplace id/state\n  }\n}","handlingStrategy":"type-guard","validationCode":"// pre-check the marketplace exists and is active\nconst marketplaces = await client.listOrgMarketplaces(orgId);\nif (!marketplaces.some((m) => m.id === marketplaceId)) {\n  throw new Error(`Marketplace not found or inactive: ${marketplaceId}`);\n}","typeGuard":"function isResolvedMarketplace(v: unknown): v is DenOrgMarketplaceResolved {\n  return (\n    typeof v === \"object\" && v !== null &&\n    \"id\" in v && \"plugins\" in v && Array.isArray((v as { plugins?: unknown }).plugins)\n  );\n}","tryCatchPattern":"try {\n  const resolved = await client.getOrgMarketplaceResolved(orgId, marketplaceId);\n} catch (err) {\n  if (err instanceof DenApiError && err.code === \"invalid_marketplace_payload\") {\n    // fall back to listOrgMarketplaces or show an empty marketplace state\n  } else { throw err; }\n}","preventionTips":["Verify marketplaceId against listOrgMarketplaces before calling /resolved","Keep Den server and client schema definitions in sync","Treat an empty/unpublished marketplace as an expected state in the UI","Bypass caches when debugging marketplace responses","Validate the parsed result with a type guard before rendering plugin details"],"tags":["marketplace","api-response","schema-mismatch","den-api"],"backgroundTag":"invalid-api-response-shape","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}