TypeError: null is not an object (evaluating 'share.url') breaks vibe-kanban integration #3180
Description
Problem Description
When using OpenCode with vibe-kanban, a TypeError occurs that completely breaks the integration:
ERROR 2025-10-14T15:45:10 +4053ms service=default name=TypeError
message=null is not an object (evaluating 'share2.url')
stack=TypeError: null is not an object (evaluating 'share2.url')
This error makes the vibe-kanban integration completely non-functional because vibe-kanban relies entirely on the share bridge mechanism to receive all data from OpenCode (AI messages, tool calls, thinking blocks).
Root Cause Analysis
The issue occurs because OpenCode attempts to access share.url without null/undefined checks in multiple locations. The share field in Session.Info is defined as optional (packages/opencode/src/session/index.ts:36-40), but the code doesn't consistently handle cases where it might be null or undefined.
Affected Code Locations
1. TUI Share Command (packages/tui/internal/tui/tui.go:1215-1224)
The code directly accesses response.Share.URL without checking if response.Share is nil.
2. Automatic Session Sharing (packages/opencode/src/session/index.ts:124-132)
When share: "auto" is configured, the sharing process runs asynchronously and errors are silently caught with catch(() => {}), leaving the share field undefined.
Why This Happens
The error can occur in several scenarios:
- Async timing issue: The sharing process hasn't completed yet when code tries to access
share.url - Silent failure: Sharing fails but the error is caught and ignored, leaving
shareundefined - Pre-existing sessions: Sessions created before enabling auto-share don't have the
sharefield populated - Network issues: HTTP request to share bridge fails
Impact on vibe-kanban Integration
According to vibe-kanban's architecture:
- vibe-kanban runs a local HTTP server (share bridge) on a random port
- OpenCode connects to it via the
OPENCODE_APIenvironment variable - OpenCode sends events to
/share_syncendpoint - vibe-kanban receives ALL data through this share bridge mechanism (not through stdout/stderr)
When sharing fails, vibe-kanban only receives stderr error logs but no actual working data (AI responses, tool calls, thinking blocks), making the integration completely broken.
Proposed Solution
Add null/undefined checks before accessing share.url in all locations:
For Go Code (TUI)
// In packages/tui/internal/tui/tui.go
if response.Share != nil && response.Share.URL != "" {
shareUrl := response.Share.URL
// ... use shareUrl safely
} else {
// Handle the case where share is not available
// Either show an error or skip share-related operations
}For TypeScript Code
// In packages/opencode/src/session/index.ts
// Instead of silently catching errors:
Session.share(session.id, { secret: session.secret })
.then((share) => {
if (share?.url) {
// Use share.url safely
}
})
.catch((error) => {
// Log the error properly instead of ignoring it
console.error("Failed to create share:", error);
});
// When accessing share.url elsewhere:
if (session.share?.url) {
const url = session.share.url;
// ... use url
}Additional Improvements
- Better error handling: Don't silently ignore sharing errors with empty
catch(() => {}) - Proper logging: Log when sharing fails so users can diagnose issues
- Graceful degradation: Allow OpenCode to continue working even if sharing fails
- Type safety: Ensure TypeScript types properly reflect that
shareis optional
Reproduction Steps
- Set up vibe-kanban integration with OpenCode
- Configure OpenCode with
share: "auto"or setOPENCODE_AUTO_SHARE=1environment variable - Create a new session
- Observe the TypeError in stderr output
- Notice that vibe-kanban shows only error messages, no actual AI responses
Environment
- OpenCode version: 0.15.2
- vibe-kanban version: 0.0.107
- Operating System: Linux devvm 6.14.0-33-generic 33~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Sep 19 17:02:30 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
- Node.js version: v22.16.0
Additional Context
The share field is defined as optional in the schema (packages/opencode/src/session/index.ts:36-40):
This means any code working with sessions must account for the possibility of this field being absent.
References
- Share sync implementation: packages/opencode/src/share/share.ts:27-35
- Session creation with auto-share: packages/opencode/src/session/index.ts:124-133
- TUI share command: packages/tui/internal/tui/tui.go:1215-1224
Notes
This issue description provides:
- Clear problem statement with error details
- Root cause analysis with specific code locations and citations
- Explanation of why this breaks vibe-kanban integration
- Concrete, implementable solutions for both Go and TypeScript code
- Reproduction steps
- Context about why the field is optional
The detailed code references and proposed solutions should make it easier for maintainers to understand and fix the issue quickly.
PS: made with DeepWiki help
Activity
rekram1-node commentedon Oct 14, 2025
hmm ill take a look
thdxr commentedon Mar 25, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.