{"record":{"id":"79b12f4f7c00b79b","repo":"mui/material-ui","slug":"could-not-find-the-mui-chat-url-please-open-a-new","errorCode":null,"errorMessage":"Could not find the MUI Chat URL, please open a new issue on https://github.com/mui/material-ui/issues/new","messagePattern":"Could not find the MUI Chat URL, please open a new issue on https://github\\.com/mui/material-ui/issues/new","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages-internal/core-docs/src/Demo/sandbox/MuiChat.ts","lineNumber":34,"sourceCode":"export function createMuiChat(demoData: DemoData, csbConfig?: SandboxConfig) {\n  const { title, githubLocation: description } = demoData;\n  const ext = getFileExtension(demoData.codeVariant);\n\n  // Get dependencies like StackBlitz\n  const { dependencies } = SandboxDependencies(demoData, {\n    commitRef: process.env.PULL_REQUEST_ID ? process.env.COMMIT_REF : undefined,\n    csbConfig,\n  });\n\n  return {\n    title,\n    description,\n    dependencies,\n    openSandbox: async () => {\n      const baseUrl = process.env.MUI_CHAT_API_BASE_URL;\n\n      if (!baseUrl) {\n        throw new Error(\n          'Could not find the MUI Chat URL, please open a new issue on https://github.com/mui/material-ui/issues/new',\n        );\n      }\n\n      // Use primaryPackage from context config, or fall back to legacy productId mapping\n      let primaryPackage = csbConfig?.primaryPackage;\n      if (!primaryPackage) {\n        const productToPackage: Record<string, string> = {\n          'material-ui': '@mui/material',\n          'x-data-grid': '@mui/x-data-grid',\n          'x-date-pickers': '@mui/x-date-pickers',\n          'x-tree-view': '@mui/x-tree-view',\n          'x-charts': '@mui/x-charts',\n        };\n        primaryPackage =\n          (demoData.productId && productToPackage[demoData.productId]) || '@mui/material';\n      }\n","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/mui/material-ui/blob/bdc96df2cb530fcdd60a7a7aabe37f610ce0f0a5/packages-internal/core-docs/src/Demo/sandbox/MuiChat.ts#L16-L52","documentation":"Thrown inside the docs sandbox helper when a user clicks 'Open in MUI Chat' but the `MUI_CHAT_API_BASE_URL` environment variable is unset. The variable is read at click time from process.env, so a missing value means the docs build was never given the Chat backend endpoint. The message directs users to file an issue because, in production, this value is injected at build time.","triggerScenarios":"Invoking `openSandbox()` on a demo's MUI Chat sandbox in a locally run docs server (`pnpm docs:dev`) without exporting MUI_CHAT_API_BASE_URL, or running a forked/preview build that did not receive the secret env injection.","commonSituations":"Local development of the docs site; CI preview builds that intentionally strip internal URLs; running the docs in an environment that does not have access to the MUI internal API.","solutions":["If you maintain the docs stack, set MUI_CHAT_API_BASE_URL in the docs dev/preview environment (e.g. export it in your shell or .env.local).","If you are a consumer, this is not actionable — file the issue as the message instructs, or use the CodeSandbox/StackBlitz buttons instead.","Verify the variable is present in the build by printing process.env.MUI_CHAT_API_BASE_URL in a throwaway log before the check."],"exampleFix":"// before: env var unset, click throws\n// after (docs contributor shell)\nexport MUI_CHAT_API_BASE_URL=https://chat.example.com\npnpm docs:dev","handlingStrategy":"validation","validationCode":"// In the docs app, guard before exposing the MUI Chat button.\nconst chatEnabled = Boolean(process.env.MUI_CHAT_API_BASE_URL);\n// render the Chat button only when chatEnabled is true","typeGuard":null,"tryCatchPattern":"try {\n  await openSandbox();\n} catch (e) {\n  if (/Could not find the MUI Chat URL/.test(e.message)) {\n    // hide the Chat entrypoint and fall back to CodeSandbox/StackBlitz\n  } else throw e;\n}","preventionTips":["Document MUI_CHAT_API_BASE_URL as a required var for the docs dev environment.","Conditionally render the Chat button based on whether the env var is set, so users never see a click that always throws.","Fail the docs build early if the var is missing in production builds."],"tags":["docs-infra","environment","configuration","runtime"],"backgroundTag":null,"analyzedSha":"bdc96df2cb530fcdd60a7a7aabe37f610ce0f0a5","analyzedAt":"2026-08-12T22:59:56.717Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}