Repository navigation
Closed
Labels
bugSomething isn't workingSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)
Description
Description
Bug: Session auto-naming silently fails when small_model is invalid
Summary
When small_model is configured to an invalid model ID (example: openai/gpt-nano), session auto-title generation fails, but the failure is silent in normal UX. The session keeps the default title (New session - ...) and only an unhandled rejection is logged.
Environment
- Source analysis branch/commit:
dev@8f2d8dd47a45a4b3972ac8badc09cc280f84b838
Why this happens (source-level)
ensureTitle()is invoked withoutawaitand without a top-level.catch(...):packages/opencode/src/session/prompt.ts:329
ensureTitle()resolves model withProvider.getSmallModel(...)first:packages/opencode/src/session/prompt.ts:1923
- If
cfg.small_modelis set,getSmallModel()does strict lookup and returnsgetModel(...)directly:packages/opencode/src/provider/provider.ts:1215
- Invalid
small_modelthrowsProviderModelNotFoundError, which bubbles to unhandled rejection path:packages/opencode/src/index.ts:36
Suggested fix (error handling + resilience)
1) Prevent silent failure at call site
Wrap title task invocation in a safe fire-and-forget pattern:
void ensureTitle({...}).catch((err) => {
log.error("failed to generate session title", { error: err })
// optionally emit a non-blocking session warning event
})2) Harden getSmallModel() against invalid small_model
If cfg.small_model is invalid:
- log a warning with configured value,
- fall back to provider heuristics (
haiku/flash/gpt-5-nano) or current conversation model, - avoid throwing in non-critical title-generation path.
3) Optional startup/config validation
Validate small_model exists at startup or config load and surface a clear warning immediately.
User workaround
Use a valid small_model ID. For example:
{
"small_model": "openai/gpt-5-nano"
}After switching to a valid ID, auto-naming works again.
Related issues
- OpenCode Desktop Session Name is no longer written with AI at times
- Show error message when session auto-naming fails due to disabled small model
Plugins
No response
OpenCode version
1.2.10
Steps to reproduce
Reproduction
- Set an invalid small model in config:
{
"$schema": "https://opencode.ai/config.json",
"small_model": "openai/gpt-nano"
}- Start OpenCode and create a new session.
- Send the first user message.
- Wait for auto-title generation.
Expected behavior
- Either:
- Session title is auto-generated successfully, or
- User receives a visible warning/error that title generation failed.
- The failure should not be silent.
Actual behavior
- Session title remains default (
New session - ...). - No clear user-facing error for title generation failure.
- Log shows only unhandled rejection:
ERROR ... service=default e=ProviderModelNotFoundError rejection
Screenshot and/or share link
No response
Operating System
macOS 26.3
Terminal
Ghostty
Reacted by Renan William and Stefan Schwarzer
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)
Activity
github-actions commentedon Feb 23, 2026
This issue might be a duplicate of existing issues. Please check:
If your issue adds something new (e.g., specifically invalid
small_modelconfig values vs. a disabled model), please clarify how it differs from #9902 so maintainers can determine if it should be merged or tracked separately.fix(session): prevent silent failure when small_model is invalid
fix(session): catch ensureTitle errors to prevent silent failure
github-actions commentedon Apr 25, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.