{"record":{"id":"332fc647807d5c1c","repo":"bytedance/deer-flow","slug":"chat-prompt-template-not-found-name-searched","errorCode":null,"errorMessage":"chat prompt template not found: {name} (searched: {searched})","messagePattern":"chat prompt template not found: (.+?) \\(searched: (.+?)\\)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"backend/packages/harness/deerflow/agents/memory/backends/deermem/deermem/core/prompt.py","lineNumber":177,"sourceCode":"                raise PromptConfigurationError(f\"Invalid YAML in {path}: {e}\") from e\n            data = data or {}\n            fmt = data.get(\"format\", \"chat\")\n            if fmt != \"chat\":\n                raise PromptConfigurationError(f\"Expected format='chat' in {path}, got {fmt!r}; use load_prompt() for text-format templates\")\n            msg_list = data.get(\"messages\")\n            if not isinstance(msg_list, list) or not msg_list:\n                raise PromptConfigurationError(f\"Missing or empty 'messages' key in {path}\")\n            raw_templates: list[dict[str, str]] = []\n            for msg in msg_list:\n                role = msg.get(\"role\", \"user\")\n                content = msg.get(\"content\", \"\")\n                if not isinstance(content, str):\n                    content = str(content)\n                raw_templates.append({\"role\": role, \"content\": content})\n            _CHAT_TEMPLATE_CACHE[cache_key] = (raw_templates, str(path))\n            return _render_messages(raw_templates, variables, str(path))\n    searched = \", \".join(str(c) for c in candidates)\n    raise FileNotFoundError(f\"chat prompt template not found: {name} (searched: {searched})\")\n\n\n# Module-level aliases for the injected text sections (staleness_review /\n# consolidation / fact_extraction). Each loads its bundled yaml template once\n# at import. ``memory_update`` is NOT here -- it uses the chat form via\n# :func:`load_prompt_messages` (system/user split, mirroring the lead agent's\n# static system prompt).\nSTALENESS_REVIEW_PROMPT = load_prompt(\"staleness_review\")\nCONSOLIDATION_PROMPT = load_prompt(\"consolidation\")\nFACT_EXTRACTION_PROMPT = load_prompt(\"fact_extraction\")\n\n\n# Module-level tiktoken encoding cache.  Populated lazily on first use;\n# subsequent calls are a dict lookup (no network I/O).  Pre-warming at\n# startup via :func:`warm_tiktoken_cache` avoids blocking a request on the\n# (potentially slow) first ``get_encoding`` call.\n#\n# A *failed* load is cached as a ``(None, monotonic_timestamp)`` tuple so that","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/backend/packages/harness/deerflow/agents/memory/backends/deermem/deermem/core/prompt.py#L159-L195","documentation":"FileNotFoundError from the deermem prompt loader: no candidate path contained a prompt template with the requested name. The message lists every searched path, so you can see exactly which directories were scanned. Module-level aliases (staleness_review, consolidation, fact_extraction) load at import, so a bad search path breaks import of the prompt module itself.","triggerScenarios":"load_prompt(name)/load_prompt_messages(name) where no <searched-dir>/<name>.yaml exists: wrong name/typo, missing prompts package data (wheel installed without data files), or a custom prompt_dir that does not contain the file.","commonSituations":"Packaging issue: package built without including bundled YAML templates (missing package_data); custom deployment that moves prompt files; renaming a prompt without updating callers; name casing mismatch on case-sensitive filesystems.","solutions":["Check the '(searched: ...)' paths in the message; place <name>.yaml in one of them.","Fix typos/casing in the requested name.","If packaging, ensure the prompt YAML files are declared as package data and present in the installed wheel.","For custom templates, point the loader's search directory at the folder containing your YAML files."],"exampleFix":"# before\nPROMPT = load_prompt(\"stalness_review\")  # typo\n\n# after\nPROMPT = load_prompt(\"staleness_review\")","handlingStrategy":"try-catch","validationCode":"from pathlib import Path\n\ndef prompt_exists(name, search_dirs) -> bool:\n    return any((d / f'{name}.yaml').is_file() for d in search_dirs)\n\nassert prompt_exists('staleness_review', prompt_dirs), 'bundled prompt missing — check packaging'","typeGuard":null,"tryCatchPattern":"try:\n    p = load_prompt('consolidation')\nexcept FileNotFoundError as e:\n    # message lists searched paths — verify packaging/deployment includes prompt YAMLs\n    raise RuntimeError(f'prompt data files missing from deployment: {e}') from e","preventionTips":["Declare prompt YAMLs as package data and smoke-test the installed wheel imports the prompt module.","Pin prompt names as module constants instead of building them dynamically.","On case-sensitive FS, match file names exactly."],"tags":["prompt","yaml","packaging","deermem","memory"],"backgroundTag":null,"analyzedSha":"1dd6ba1acb03700589994b0366c5d1c7d05e2eff","analyzedAt":"2026-08-14T21:20:34.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}