Skip to content

fix: don't emit invalid "embedding" output modality (crashes TUI on startup)#30

Closed
aluzed wants to merge 1 commit into
agustif:mainfrom
aluzed:fix/embedding-modality-schema
Closed

fix: don't emit invalid "embedding" output modality (crashes TUI on startup)#30
aluzed wants to merge 1 commit into
agustif:mainfrom
aluzed:fix/embedding-modality-schema

Conversation

@aluzed

@aluzed aluzed commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Problem

After updating OpenCode (reproduced on 1.16.2), the TUI crashes on startup with:

config.get: Expected "text" | "audio" | "image" | "video" | "pdf", got "embedding"
  at ["provider"]["lmstudio"]["models"]["text-embedding-...""]["modalities"]["output"][0]
... tui bootstrap failed

Recent OpenCode releases tightened model-config schema validation. The plugin sets modalities.output = ["embedding"] for embedding models in enhance-config.ts, but embedding is no longer an accepted modality value — so the whole config fails validation and OpenCode refuses to boot whenever LM Studio exposes an embedding model (e.g. text-embedding-nomic-embed-text-v1.5).

Fix

Register embedding models without an explicit modalities field, letting OpenCode apply its defaults instead of rejecting the config. Chat models are unaffected. Embedding models are still discovered and counted (the "only embedding models found" guidance still works).

Verification

  • npm run typecheck
  • npm run test:run ✅ (16/16)
  • Reproduced the crash locally with an LM Studio instance exposing an embedding model, then confirmed the fix: no more schema rejection / tui bootstrap failed, providers initialize, and chat models resolve and reach LM Studio.

🤖 Generated with Claude Code

OpenCode's model schema validation (tightened in recent releases, e.g.
1.16.x) only accepts text/audio/image/video/pdf as modality values.
Emitting `output: ["embedding"]` for embedding models triggers a
schema rejection (`config.get: Expected "text" | "audio" | "image" |
"video" | "pdf", got "embedding"`) that crashes the TUI on startup
("tui bootstrap failed").

Register embedding models without an explicit `modalities` field so
OpenCode applies its defaults instead of rejecting the config. Chat
models are unaffected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@agustif

agustif commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Thank you @aluzed for identifying the embedding-modality startup crash. The typed 1.0 rewrite in #31 now filters embeddings using LM Studio’s explicit model type, and the release notes/CONTRIBUTORS.md credit this contribution. Closing as superseded by #31.

@agustif agustif closed this Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants