{"record":{"id":"55333fbf8c23902f","repo":"Budibase/budibase","slug":"could-not-resolve-budibase-app-for-path-apppath","errorCode":null,"errorMessage":"Could not resolve Budibase app for path: ${appPath}","messagePattern":"Could not resolve Budibase app for path: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/client/src/index.ts","lineNumber":171,"sourceCode":"}\n\nconst normalizeAppPath = (pathOrUrl: string) => {\n  const pathname = getPathname(pathOrUrl).replace(/\\/$/, \"\")\n  if (!pathname) {\n    return \"\"\n  }\n  if (pathname.startsWith(\"/app/\")) {\n    return pathname\n  }\n  return pathname.startsWith(\"/\") ? `/app${pathname}` : `/app/${pathname}`\n}\n\nconst resolveAppIdFromPath = async (appPath: string) => {\n  const publishedApps = await API.getPublishedApps()\n  const pathToMatch = appPath.replace(/\\/$/, \"\")\n  const matched = publishedApps.find(app => `/app${app.url}` === pathToMatch)\n  if (!matched?.prodId) {\n    throw new Error(`Could not resolve Budibase app for path: ${appPath}`)\n  }\n  return matched.prodId\n}\n\nconst normalizeRoutePath = (path: string) => {\n  if (!path) {\n    return \"/\"\n  }\n  const [pathname = \"/\", query = \"\"] = path.split(\"?\")\n  const normalizedPathname = pathname.startsWith(\"/\")\n    ? pathname\n    : `/${pathname}`\n  if (!query) {\n    return normalizedPathname\n  }\n  return `${normalizedPathname}?${query}`\n}\n","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/client/src/index.ts#L153-L189","documentation":"In the client SDK, resolveAppIdFromPath matches a given appPath against the list of published apps fetched via API.getPublishedApps(), comparing `/app${app.url}` to the normalized path. If no published app matches, or the match has no prodId (production app ID), the embed cannot proceed and this error is thrown.","triggerScenarios":"Calling mountBudibaseApp without an explicit appId where appPath (normalized from appUrl) does not equal `/app<url>` of any published app, or the matching app has no prodId — e.g. the app is unpublished, the URL is wrong, or the path has extra segments/trailing content.","commonSituations":"Embedding an app whose production deployment doesn't exist (app only in dev); appUrl typo or wrong domain path; published app list unavailable/empty due to API failure; app renamed so its URL changed; passing a full URL where only the app path is expected.","solutions":["Pass the appId option explicitly to mountBudibaseApp so path resolution is skipped","Verify the app is published (deployed to production) and its URL matches: path must be exactly `/app${app.url}` after stripping a trailing slash","Log/check API.getPublishedApps() output and correct the appUrl to one of the published app URLs"],"exampleFix":"// before\nmountBudibaseApp({ target: el, appUrl: \"/my-app\" })\n// Error: Could not resolve Budibase app for path: /my-app\n// after: pass appId explicitly\nmountBudibaseApp({ target: el, appId: \"app_dev_123 prodId\", appUrl: \"/my-app\" })","handlingStrategy":"try-catch","validationCode":"const apps = await API.getPublishedApps()\nconst normalized = appUrl.replace(/\\/$/, \"\")\nconst match = apps.find(a => `/app${a.url}` === normalized && a.prodId)\nif (!match) throw new Error(`No published app matches ${normalized}; pass appId explicitly`)","typeGuard":"const isPublishedApp = (a: { url?: string; prodId?: string } | undefined): a is { url: string; prodId: string } =>\n  Boolean(a && a.url && a.prodId)","tryCatchPattern":"try {\n  await mountBudibaseApp({ target: el, appUrl })\n} catch (err) {\n  if ((err as Error).message.startsWith(\"Could not resolve Budibase app\")) {\n    // fall back: mount with an explicit appId or show a config error\n  } else throw err\n}","preventionTips":["Always publish (deploy) the app before embedding it","Pass the appId option to skip path-based resolution entirely","Ensure appUrl matches the published app's URL exactly (path only, no origin, trailing slash tolerated)"],"tags":["client-sdk","embedding","app-resolution","configuration"],"backgroundTag":"app-not-found","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}