When you run OpenCode in TUI mode, check the console output for these log messages:
[opencode-lmstudio] LM Studio plugin initialized- Plugin loaded[opencode-lmstudio:DEBUG] Config hook called- Config hook invoked[opencode-lmstudio:DEBUG] Created provider (quick check)- Provider created[opencode-lmstudio:DEBUG] enhanceConfig called- Model discovery started[opencode-lmstudio] Discovered LM Studio models- Models found[opencode-lmstudio] Added discovered LM Studio models to config- Models added[opencode-lmstudio:DEBUG] Config hook returning- Hook completed
-
Is the plugin loaded?
- Look for:
[opencode-lmstudio] LM Studio plugin initialized - If missing: Plugin not installed or not in config
- Look for:
-
Is the config hook being called?
- Look for:
[opencode-lmstudio:DEBUG] Config hook called - If missing: OpenCode might not be calling the hook
- Look for:
-
Are models being discovered?
- Look for:
[opencode-lmstudio] Discovered LM Studio models { count: X } - If count is 0: LM Studio might not be running or no models available
- Look for:
-
Are models being added to config?
- Look for:
[opencode-lmstudio] Added discovered LM Studio models to config - Check:
modelCountin the final log message
- Look for:
-
Is the config frozen?
- Look for:
configFrozen: truein the debug log - If true: OpenCode might be passing a frozen config object
- Look for:
Possible causes:
- Config hook not being awaited by OpenCode
- Config object is frozen/read-only
- OpenCode reads config before hook completes
- Config object is cloned before hook runs
Debug steps:
- Check console logs for the sequence above
- Look for warnings about frozen config
- Check if
modelCountis 0 in final log - Verify LM Studio is running:
curl http://127.0.0.1:1234/v1/models
Check:
- Plugin is in
opencode.json:"plugin": ["opencode-lmstudio"] - Plugin is installed:
npm list opencode-lmstudio - No errors in OpenCode startup logs
Check:
- LM Studio is running
- Server is active (green indicator in LM Studio)
- Port is correct (default: 1234)
- Try:
curl http://127.0.0.1:1234/v1/models
Run this to test the plugin directly:
bun debug-opencode-simulation.tsThis simulates how OpenCode calls the plugin and shows if models are loaded correctly.