# LLM 设置错误在 Discourse AI 中 - “目标不能为空”

**URL:** <https://meta.discourse.org/t/llm-error-in-discourse-ai-target-cant-be-blank/391497>\
**Category:** Bug\
**Tags:** ai\
**Created:** [2025年十二月16日 20:43 UTC](https://meta.discourse.org/t/llm-error-in-discourse-ai-target-cant-be-blank/391497 "2025-12-16T20:43:54Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)\
**Post date:** [2025年十二月16日 21:32 UTC](https://meta.discourse.org/t/llm-error-in-discourse-ai-target-cant-be-blank/391497/2 "2025-12-16T21:32:21Z")

</div>

抱歉，@Lilly，这个问题应该已经通过

> <https://github.com/discourse/discourse/pull/36735>
>
> When testing a new LLM configuration in the admin panel, if the test fails (e.g.…, invalid API key), users see "Target can't be blank" instead of the actual error from the LLM provider.
> 
> This happens because \`track\_failures\` attempts to create a ProblemCheckTracker using \`llm\_model.id\` as the target, but unsaved models have \`id = nil\`, which fails the \`validates :target, presence: true\` validation.
> 
> The fix adds a \`new\_record?\` check to skip failure tracking for unsaved models, consistent with the existing checks for \`blank?\` and \`seeded?\`.
> 
> Ref - https://meta.discourse.org/t/391497

修复了

（抄送 @Roman）

---

_[View the full topic](https://meta.discourse.org/t/llm-error-in-discourse-ai-target-cant-be-blank/391497)._
