{"record":{"id":"3d52056fc65cf27b","repo":"different-ai/openwork","slug":"result-message","errorCode":null,"errorMessage":"${result.message}","messagePattern":"\\$\\{result\\.message\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ee/apps/den-api/src/mcp/capability-registry.ts","lineNumber":641,"sourceCode":"      .map((reference) => [`${reference.pluginId}:${reference.configObjectId}`, reference]))\n    return [...uniqueReferences.values()].map((reference) => {\n      const capabilityName = `plugin:${reference.pluginId}:${reference.configObjectId}`\n      const parsed: Extract<ParsedCapability, { kind: \"marketplace\" }> = {\n        kind: \"marketplace\",\n        name: capabilityName,\n        pluginId: reference.pluginId,\n        configObjectId: reference.configObjectId,\n      }\n      return contentLeaf({\n        namespace: \"marketplace\",\n        toolName: capabilityName,\n        capabilityName,\n        description: `Retrieve marketplace capability ${capabilityName}`,\n        readOnly: true,\n        authority: \"den\",\n        run: async (args) => {\n          const result = await executeMarketplaceSource(ctx, parsed, { name: capabilityName, body: args })\n          if (!result.ok) throw toolError(result.message)\n          const content = result.result.content ?? result.result.source ?? result.result.definition\n          return typeof content === \"string\" ? content : JSON.stringify(result.result)\n        },\n      })\n    })\n  },\n  execute: async (ctx, parsed, input) => {\n    if (!parsedForKind(parsed, \"marketplace\")) return unknownCapabilityResult(input.name)\n    const result = await executeMarketplaceSource(ctx, parsed, input)\n    if (!result.ok) {\n      return result.error === \"unknown_capability\"\n        ? unknownCapabilityResult(input.name)\n        : marketplaceCapabilityErrorToolResult(result)\n    }\n    return {\n      content: textContent(JSON.stringify(result.result, null, 2)),\n      structuredContent: result.result,\n    }","sourceCodeStart":623,"sourceCodeEnd":659,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/ee/apps/den-api/src/mcp/capability-registry.ts#L623-L659","documentation":"The marketplace capability tool runner in capability-registry.ts calls executeMarketplaceSource to run a marketplace capability; when the result is not ok, it throws toolError(result.message), surfacing the underlying marketplace failure as the tool's error message. The registry merely propagates the source-level failure to the MCP tool caller.","triggerScenarios":"Invoking a generated marketplace capability tool (retrieve marketplace capability <name>) where executeMarketplaceSource returns { ok: false } — e.g. the capability is missing from the marketplace, the execution request fails validation, or the upstream marketplace service errors.","commonSituations":"Capability unpublished or renamed after the registry snapshot was built; malformed args failing the marketplace's validation; marketplace backend outage or permission denial for the org; stale registry cache referencing removed capabilities.","solutions":["Read the embedded result.message for the actual marketplace failure and fix it accordingly.","Re-fetch/refresh the marketplace capability list so the registry stops exposing stale capability names.","Verify the capability still exists and is published to the org's marketplace.","Check marketplace service health and the caller's permissions if the message indicates authz or backend failure."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const listing = await getMarketplaceCapabilities(ctx)\nif (!listing.some((c) => c.name === capabilityName)) {\n  throw new Error(`capability ${capabilityName} not found in marketplace`)\n}","typeGuard":"function isSourceFailure<T>(r: { ok: boolean; message: string } & T): r is { ok: false; message: string } {\n  return r.ok === false\n}","tryCatchPattern":"try {\n  result = await executeMarketplaceSource(ctx, parsed, { name: capabilityName, body: args })\n} catch (error) {\n  // toolError already embeds result.message; refresh registry and retry once on stale-capability errors\n  await refreshMarketplaceRegistry()\n  throw error\n}","preventionTips":["Refresh the capability registry after marketplace publish/unpublish events.","Validate capability names against a fresh listing before invoking.","Confirm org permissions for the marketplace capability.","Check marketplace backend health on repeated failures."],"tags":["mcp","marketplace","tool-execution","propagated-error"],"backgroundTag":"capability-execution-failed","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}