{"record":{"id":"3eebb8da24ca29a6","repo":"nikivdev/code","slug":"docs-template-root-not-found","errorCode":null,"errorMessage":"Docs template root not found: {}","messagePattern":"Docs template root not found: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/docs.rs","lineNumber":421,"sourceCode":"    }\n\n    ensure_docs_hub_deps(&hub_root)?;\n    run_docs_hub_dev(&hub_root, &opts.host, opts.port, opts.no_open)\n}\n\nfn ensure_docs_hub(hub_root: &Path, template_root: &Path) -> Result<()> {\n    if hub_root.join(\"package.json\").exists() {\n        sync_docs_hub_template_file(hub_root, template_root, \"mdx-components.tsx\", true)?;\n        sync_docs_hub_template_file(hub_root, template_root, \"next.config.mjs\", true)?;\n        sync_docs_hub_template_file(hub_root, template_root, \"public/favicon.ico\", false)?;\n        sync_docs_hub_template_file(hub_root, template_root, \"wrangler.toml\", false)?;\n        ensure_docs_hub_flow_toml(hub_root, template_root)?;\n        ensure_docs_hub_config(hub_root)?;\n        ensure_docs_hub_layout(hub_root)?;\n        return Ok(());\n    }\n    if !template_root.exists() {\n        bail!(\"Docs template root not found: {}\", template_root.display());\n    }\n    fs::create_dir_all(hub_root)\n        .with_context(|| format!(\"failed to create {}\", hub_root.display()))?;\n    copy_template_dir(template_root, hub_root)?;\n    ensure_docs_hub_config(hub_root)?;\n    ensure_docs_hub_layout(hub_root)?;\n    Ok(())\n}\n\npub fn ensure_docs_hub_daemon(opts: &DocsHubOpts) -> Result<()> {\n    let focus_root = focus_project_root_from_env();\n    ensure_docs_hub_daemon_with_focus(opts, focus_root.as_deref())\n}\n\nfn ensure_docs_hub_daemon_with_focus(opts: &DocsHubOpts, focus_root: Option<&Path>) -> Result<()> {\n    let hub_root = config::expand_path(&opts.hub_root);\n    let template_root = config::expand_path(&opts.template_root);\n    println!(","sourceCodeStart":403,"sourceCodeEnd":439,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/docs.rs#L403-L439","documentation":"ensure_docs_hub bails when the docs hub template root directory does not exist. Unlike the scaffold path, this error is raised only when template_root itself (not a subdirectory) is absent, preventing the copy of the template into hub_root and the subsequent config/layout setup steps.","triggerScenarios":"Calling run_docs_hub, ensure_docs_hub_daemon_with_focus, or deploy_docs_hub with a hub_root whose template_root (resolved from configuration) does not exist — e.g. config points to a custom template path that was deleted, or the bundled template root was never installed.","commonSituations":"User overrode the template root in flow.toml/config with a typo or moved path; template assets removed by cleanup tooling; running the binary from a different working directory than expected where relative template roots no longer resolve.","solutions":["Check the template root path shown in the message exists on disk; correct the configured path if it moved","Restore/reinstall the bundled docs template assets for this tool version","Use an absolute path for a custom template root in your configuration to avoid working-directory dependence","Re-run the tool's install/bootstrap step to recreate the template root"],"exampleFix":"// before (config)\ntemplate_root = \"~/code/templates/docs-hub\"  // deleted\n// after\ntemplate_root = \"~/.local/share/mytool/docs-hub-template\"  // exists, absolute","handlingStrategy":"validation","validationCode":"let template_root = config::expand_path(&cfg.template_root);\nif !template_root.exists() {\n    eprintln!(\"configured template root {} missing; restore assets or fix config\", template_root.display());\n    std::process::exit(1);\n}\nrun_docs_hub(&opts)?;","typeGuard":null,"tryCatchPattern":"match ensure_docs_hub(&hub_root) {\n    Ok(()) => {}\n    Err(e) if e.to_string().contains(\"Docs template root not found\") => {\n        eprintln!(\"fix template_root in config or reinstall template assets\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Keep custom template_root values absolute and verify them after edits to flow.toml","Re-run the installer after tool upgrades to lay out template assets at the new expected path","Add a smoke check in setup scripts: test -d \"$template_root\" before invoking hub commands","Avoid cleaning tool data directories with blanket rm scripts"],"tags":["rust","missing-file","docs-hub","configuration"],"backgroundTag":"missing-template-asset","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}