Skip to content

TypeError: null is not an object (evaluating 'share.url') breaks vibe-kanban integration #3180

Closed

Description

@smart-tinker

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:

  1. Async timing issue: The sharing process hasn't completed yet when code tries to access share.url
  2. Silent failure: Sharing fails but the error is caught and ignored, leaving share undefined
  3. Pre-existing sessions: Sessions created before enabling auto-share don't have the share field populated
  4. 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_API environment variable
  • OpenCode sends events to /share_sync endpoint
  • 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

  1. Better error handling: Don't silently ignore sharing errors with empty catch(() => {})
  2. Proper logging: Log when sharing fails so users can diagnose issues
  3. Graceful degradation: Allow OpenCode to continue working even if sharing fails
  4. Type safety: Ensure TypeScript types properly reflect that share is optional

Reproduction Steps

  1. Set up vibe-kanban integration with OpenCode
  2. Configure OpenCode with share: "auto" or set OPENCODE_AUTO_SHARE=1 environment variable
  3. Create a new session
  4. Observe the TypeError in stderr output
  5. 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

  1. rekram1-node commented on Oct 14, 2025

    @rekram1-node
    Contributor

    hmm ill take a look

  2. thdxr commented on Mar 25, 2026

    @thdxr
    Member

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions