CopilotKit/CopilotKit · warning
Thread name generation returned an empty or invalid title
Error message
Thread name generation returned an empty or invalid title
What it means
The runtime's automatic thread-naming feature asks the configured agent to generate a title for a new thread, retrying over multiple attempts. When an attempt completes but yields an empty/invalid title (agent returned empty string or the pipeline validated it away), the runtime logs this warning with agentId, attempt, and threadId and tries again; if all attempts fail, the thread simply keeps its default name.
Source
Thrown at packages/runtime/src/v2/runtime/handlers/intelligence/thread-names.ts:75
}
let generatedTitle: string | null = null;
for (let attempt = 1; attempt <= MAX_TITLE_GENERATION_ATTEMPTS; attempt++) {
try {
generatedTitle = await runTitleGenerationAttempt({
runtime,
request,
agentId,
threadId: thread.id,
prompt,
});
if (generatedTitle) {
break;
}
logger.warn(
{ agentId, attempt, threadId: thread.id },
"Thread name generation returned an empty or invalid title",
);
} catch (error) {
logger.warn(
{ err: error, agentId, attempt, threadId: thread.id },
"Thread name generation attempt failed",
);
}
}
await runtime.intelligence.updateThread({
threadId: thread.id,
userId,
agentId,
updates: { name: generatedTitle ?? FALLBACK_THREAD_TITLE },
});
}View on GitHub (pinned to 68fbe97d87)
Solutions
- Check the configured naming agent/prompt — make it explicitly return a short non-empty title string
- Use a stronger model for title generation if the current one returns empty responses
- If thread naming is unimportant, disable the intelligence thread-naming feature to remove the noise
- Reproduce with logging on the naming attempt to see the raw model output before validation
Example fix
// before: naming prompt that invites empty output "Name this conversation." // after "Name this conversation. Respond with ONLY the title, 3-6 words, never empty. Example: 'Bug fix discussion'"
Defensive patterns
Strategy: validation
Validate before calling
const isValidTitle = (t: unknown): t is string => typeof t === "string" && t.trim().length > 0 && t.trim().length <= 100;
Type guard
const isNonEmptyTitle = (t: unknown): t is string => typeof t === "string" && t.trim().length > 0;
Prevention
- Prompt the naming model for a mandatory 3-6 word non-empty title
- Use a model reliable enough to not return empty completions
- Validate and retry naming output agent-side before returning
When it happens
Trigger: handleIntelligenceRun -> generateThreadNameForNewThread calls runTitleGenerationAttempt; the agent finishes generation but generatedTitle is falsy — e.g. the model replied with empty output, a title-extraction step stripped everything, or the agent's graph ends without producing a title state.
Common situations: Small/weak models returning empty completions for naming prompts; misconfigured title-generation prompts that get filtered out by output validators; token limits truncating the title to nothing; intelligence/thread-naming feature enabled with a model that doesn't handle the naming task.
Related errors
- Skipping thread naming because the agent could not be cloned
- channel "${opts.name ?? "(unnamed)"}" failed to start its ma
- channel_memory_unavailable
- A delegate is only created for Intelligence mode
- Intelligence mode requires runtimeUrl, agentId, and intellig
AI-assisted analysis of CopilotKit/CopilotKit@68fbe97d87 (2026-08-27).
Data as JSON: /api/errors/c68865b68cce777d.
Report an issue: GitHub.