{"record":{"id":"033c0cfe3b52a122","repo":"BoundaryML/baml","slug":"could-not-find-packaged-playground-assets-for-local","errorCode":null,"errorMessage":"could not find packaged playground assets. For local debugging, run `pnpm --filter app-vscode-webview dev -- --host 127.0.0.1 --port 4000` and set `BAML_PLAYGROUND_DEV_PORT=4000`, or set `BAML_PLAYGROUND_DIR` to a built app-vscode-webview/dist directory.","messagePattern":"could not find packaged playground assets\\. For local debugging, run `pnpm --filter app-vscode-webview dev -- --host 127\\.0\\.0\\.1 --port 4000` and set `BAML_PLAYGROUND_DEV_PORT=4000`, or set `BAML_PLAYGROUND_DIR` to a built app-vscode-webview/dist directory\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_cli/src/playground_command.rs","lineNumber":140,"sourceCode":"    let root = project.root().to_path_buf();\n    if project.files.is_empty() {\n        anyhow::bail!(\"no `.baml` files found in {}\", root.display());\n    }\n    Ok(vec![root])\n}\n\nfn resolve_playground_assets() -> Result<Option<PathBuf>> {\n    if std::env::var_os(\"BAML_PLAYGROUND_DEV_PORT\").is_some()\n        || std::env::var_os(\"BAML_PLAYGROUND_DIR\").is_some()\n    {\n        return Ok(None);\n    }\n\n    if let Some(dir) = discover_playground_dir()? {\n        return Ok(Some(dir));\n    }\n\n    anyhow::bail!(\n        \"could not find packaged playground assets. For local debugging, run \\\n         `pnpm --filter app-vscode-webview dev -- --host 127.0.0.1 --port 4000` \\\n         and set `BAML_PLAYGROUND_DEV_PORT=4000`, or set `BAML_PLAYGROUND_DIR` \\\n         to a built app-vscode-webview/dist directory.\"\n    );\n}\n\nfn discover_playground_dir() -> Result<Option<PathBuf>> {\n    let exe = std::env::current_exe().context(\"could not resolve current executable\")?;\n    let Some(bin_dir) = exe.parent() else {\n        return Ok(None);\n    };\n\n    Ok(playground_dir_candidates(bin_dir)\n        .into_iter()\n        .find(|path| is_playground_dir(path)))\n}\n","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_cli/src/playground_command.rs#L122-L158","documentation":"resolve_playground_assets locates the web UI assets (app-vscode-webview/dist) bundled with the CLI. When discover_playground_dir() finds nothing packaged or configured, it bails with instructions for local debugging. Without these assets the playground cannot serve its frontend.","triggerScenarios":"Running `baml playground` when: no packaged assets directory exists next to the binary, BAML_PLAYGROUND_DEV_PORT is unset, and BAML_PLAYGROUND_DIR is unset or points to a non-existent/non-built directory — i.e. discover_playground_dir() returns None.","commonSituations":"Running a CLI built from a source checkout without building the webview frontend first; a release build stripped of packaged assets; BAML_PLAYGROUND_DIR pointing to the wrong path or an unbuilt repo; typo'd env var.","solutions":["Set BAML_PLAYGROUND_DIR to a built app-vscode-webview/dist directory.","For local debugging: run `pnpm --filter app-vscode-webview dev -- --host 127.0.0.1 --port 4000` and set BAML_PLAYGROUND_DEV_PORT=4000.","Install a packaged release of the BAML CLI that ships playground assets.","Verify the dist directory exists (build it with pnpm install && pnpm build in the webview workspace)."],"exampleFix":"// before\nBAML_PLAYGROUND_DIR=./nonexistent baml playground\n\n// after\npnpm --filter app-vscode-webview dev -- --host 127.0.0.1 --port 4000\nexport BAML_PLAYGROUND_DEV_PORT=4000\nbaml playground","handlingStrategy":"fallback","validationCode":"# shell: pick assets location up front\nif [ -z \"$BAML_PLAYGROUND_DIR\" ] && [ ! -d \"$REPO/app-vscode-webview/dist\" ]; then\n  echo 'Build webview or set BAML_PLAYGROUND_DIR'; exit 1\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build app-vscode-webview/dist once before running a source-built CLI.","Export BAML_PLAYGROUND_DIR in your dev shell profile pointing at the dist directory.","Use packaged release binaries which ship the assets.","Double-check env var spelling (BAML_PLAYGROUND_DIR vs BAML_PLAYGROUND_DEV_PORT)."],"tags":["cli","baml","playground","missing-assets","env-var"],"backgroundTag":"missing-env-var","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}