[PR #10632] fix(session): handle ModelNotFoundError gracefully in prompt loop #13506

Open
opened 2026-02-16 18:18:21 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/10632

State: open
Merged: No


When using a non-existent provider/model, the application now:

  • Publishes Session.Event.Error to notify clients properly
  • Displays a friendly error message instead of stack trace
  • Prevents UI disruption in TUI/Web mode

Changes:

  • Add try-catch for Provider.getModel() in loop function
  • Add try-catch for subtask model retrieval
  • Handle errors gracefully in session prompt route

Fixes UI disruption when using custom providers like oh-my-opencode's sisypus

What does this PR do?

How did you verify your code works?

  • [√] Run opencode run -m "sisypus/test-model" "hello"
  • [√] Verify clean error message: Error: Model not found: sisypus/test-model.
  • [√] Verify no stack trace is displayed

Fixes #10631

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/10632 **State:** open **Merged:** No --- When using a non-existent provider/model, the application now: - Publishes Session.Event.Error to notify clients properly - Displays a friendly error message instead of stack trace - Prevents UI disruption in TUI/Web mode Changes: - Add try-catch for Provider.getModel() in loop function - Add try-catch for subtask model retrieval - Handle errors gracefully in session prompt route Fixes UI disruption when using custom providers like oh-my-opencode's sisypus ### What does this PR do? ### How did you verify your code works? - [√] Run `opencode run -m "sisypus/test-model" "hello"` - [√] Verify clean error message: `Error: Model not found: sisypus/test-model.` - [√] Verify no stack trace is displayed Fixes #10631
yindo added the pull-request label 2026-02-16 18:18:21 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13506