{"record":{"id":"bdd253cbb9cba80f","repo":"zed-industries/zed","slug":"invalid-template","errorCode":null,"errorMessage":"Invalid template","messagePattern":"Invalid template","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/agent/src/thread.rs","lineNumber":4328,"sourceCode":"\n        messages\n    }\n\n    fn build_request_messages_until(\n        &self,\n        available_tools: Vec<SharedString>,\n        end_ix: usize,\n        cx: &App,\n    ) -> Vec<LanguageModelRequestMessage> {\n        let end_ix = end_ix.min(self.messages.len());\n        log::trace!(\"Building request messages from {} thread messages\", end_ix);\n\n        let user_agents_md = UserAgentsMd::global(cx).and_then(|s| s.content().cloned());\n        let system_prompt = SystemPromptTemplate {\n            project: self.project_context.read(cx),\n            available_tools,\n            model_name: self.model().map(|m| m.name().0.to_string()),\n            date: Local::now().format(\"%Y-%m-%d\").to_string(),\n            user_agents_md,\n            sandboxing: crate::sandboxing::sandboxing_enabled_for_project(\n                self.project.read(cx),\n                cx,\n            ),\n            is_linux: cfg!(target_os = \"linux\"),\n            is_windows: cfg!(target_os = \"windows\"),\n        }\n        .render(&self.templates)\n        .context(\"failed to build system prompt\")\n        .expect(\"Invalid template\");\n        let mut messages = vec![LanguageModelRequestMessage {\n            role: Role::System,\n            content: vec![system_prompt.into()],\n            cache: false,\n            reasoning_details: None,\n        }];\n        self.extend_request_history_until(&mut messages, end_ix);","sourceCodeStart":4310,"sourceCodeEnd":4346,"githubUrl":"https://github.com/zed-industries/zed/blob/5a9b9558db01a6b906cec2fb70a797affdc58cdd/crates/agent/src/thread.rs#L4310-L4346","documentation":"Error building the system prompt in the agent thread: the SystemPromptTemplate could not be rendered (e.g. a required template placeholder is missing or the template file is malformed), so the request message construction for the LLM call cannot proceed.","triggerScenarios":"Thrown at crates/agent/src/thread.rs:4327 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the built-in system prompt template for missing or malformed placeholders","Verify project context and available tools are populated before building the request","Update the agent crate if the shipped template is out of sync with the code"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5a9b9558db01a6b906cec2fb70a797affdc58cdd","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}