{"record":{"id":"59dd005ddb39050a","repo":"different-ai/openwork","slug":"remote-app-not-found","errorCode":"remote_app_not_found","errorMessage":"Remote MCP App not found.","messagePattern":"Remote MCP App not found\\.","errorType":"http","errorClass":"RemoteMcpAppError","httpStatus":404,"severity":"error","filePath":"ee/apps/den-api/src/remote-mcp-apps.ts","lineNumber":359,"sourceCode":"  }\n  const metadata = remoteMcpAppDocumentMetadataSchema.safeParse(value.metadata)\n  const source = isRecord(value.source) ? value.source : null\n  const resource = isRecord(value.resource) ? value.resource : null\n  if (!metadata.success || !source || !resource\n    || typeof source.url !== \"string\" || typeof source.resolvedUrl !== \"string\" || typeof source.fetchedAt !== \"string\"\n    || (source.contentType !== null && typeof source.contentType !== \"string\")\n    || typeof resource.byteSize !== \"number\" || typeof resource.digest !== \"string\") {\n    throw new RemoteMcpAppError(422, \"invalid_cached_app\", \"The cached app revision metadata is invalid.\")\n  }\n  return value as RemoteMcpAppVersionPayload\n}\n\nasync function getAppRow(context: PluginArchActorContext, configObjectId: string, role: \"viewer\" | \"editor\" | \"manager\" = \"viewer\") {\n  let id: DenTypeId<\"configObject\">\n  try {\n    id = normalizeDenTypeId(\"configObject\", configObjectId)\n  } catch {\n    throw new RemoteMcpAppError(404, \"remote_app_not_found\", \"Remote MCP App not found.\")\n  }\n  const rows = await db\n    .select()\n    .from(RemoteMcpAppTable)\n    .where(and(eq(RemoteMcpAppTable.organizationId, context.organizationContext.organization.id), eq(RemoteMcpAppTable.configObjectId, id)))\n    .limit(1)\n  const app = rows[0]\n  if (!app) throw new RemoteMcpAppError(404, \"remote_app_not_found\", \"Remote MCP App not found.\")\n  await requirePluginArchResourceRole({ context, resourceId: app.configObjectId, resourceKind: \"config_object\", role })\n  return app\n}\n\nfunction serializeRevision(row: RemoteMcpAppVersionRow, activeVersionId: string | null) {\n  const payload = parseVersionPayload(row)\n  return {\n    id: row.id,\n    active: row.id === activeVersionId,\n    createdAt: row.createdAt.toISOString(),","sourceCodeStart":341,"sourceCodeEnd":377,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/ee/apps/den-api/src/remote-mcp-apps.ts#L341-L377","documentation":"getAppRow first normalizes the incoming configObjectId into a DenTypeId<\"configObject\">. If the identifier is not a valid den configObject id (normalizeDenTypeId throws), the error is swallowed and a 404 remote_app_not_found is thrown, deliberately not leaking id-format validation details.","triggerScenarios":"Calling any app-scoped API (app, restored, etc.) with a configObjectId that is not a syntactically valid den configObject id — malformed id, wrong id type (e.g. a plugin id passed where a configObject id is expected), or empty/URL-decoded incorrectly.","commonSituations":"Client caching stale or truncated ids; passing a plugin id instead of the app's configObject id; ids mangled by string concatenation in scripts or by double URL-encoding in a proxy.","solutions":["Verify you are passing the app's configObject id exactly as returned when the app was created/listed.","Fetch the current app list to obtain a fresh, valid id.","Check for double-encoding/truncation of the id in your client or proxy.","Ensure you are not passing a plugin id where the remote MCP app's configObject id is required."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { normalizeDenTypeId } from \"./ids.js\";\ntry { normalizeDenTypeId(\"configObject\", configObjectId); }\ncatch { throw new Error(\"Invalid configObject id before calling the API\"); }","typeGuard":"function isConfigObjectId(id: string): boolean {\n  try { normalizeDenTypeId(\"configObject\", id); return true; } catch { return false; }\n}","tryCatchPattern":"try {\n  const app = await getRemoteMcpApp(context, configObjectId);\n} catch (e) {\n  if (e instanceof RemoteMcpAppError && e.code === \"remote_app_not_found\") {\n    // id was malformed or the app does not exist; refresh from the app list\n  } else throw e;\n}","preventionTips":["Store ids exactly as returned by the API; never reconstruct them by string concatenation.","Validate id format client-side before calling app-scoped endpoints.","Beware double URL-encoding of ids in proxies or query strings.","Keep the plugin id and the app's configObject id distinct in your client state."],"tags":["not-found","identifier","validation"],"backgroundTag":"resource-not-found","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}