Skip to content

[Bug][Web] Basic auth causes 401 on /site.webmanifest and /global/event, then crashes with PasteTypeError #16493

Closed as not planned

Description

@Kevin-HYX

Description

When running OpenCode Web with server auth enabled (OPENCODE_SERVER_USERNAME / OPENCODE_SERVER_PASSWORD), the app partially loads, but two requests fail with 401:

  • GET /site.webmanifest -> 401 Unauthorized
  • GET /global/event -> fetch failed / unauthorized

After that, the UI crashes with:

PasteTypeError: Cannot read properties of undefined (reading 'length')

This looks like a web auth inconsistency + missing frontend guard after unauthorized event/manifest fetch.

Plugins

No response

OpenCode version

1.2.20

Steps to reproduce

  1. On Windows, set env vars for web auth:
    • OPENCODE_SERVER_USERNAME=<redacted>
    • OPENCODE_SERVER_PASSWORD=<redacted>
  2. Start web mode: opencode web
  3. Open browser to local URL (e.g. http://127.0.0.1:<port>)
  4. Observe console/network errors and then frontend crash.

Screenshot and/or share link

Console snippets (sanitized):

  • GET http://127.0.0.1:40960/site.webmanifest 401 (Unauthorized)
  • Fetch failed loading: GET "http://127.0.0.1:40960/global/event"
  • PasteTypeError: Cannot read properties of undefined (reading 'length')
    at assets/session-*.js
    at assets/index-*.js

Operating System

Windows

Terminal

PowerShell

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    webRelates to opencode on web / desktop
    on Mar 7, 2026
  2. github-actions commented on Mar 7, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue is distinct, please clarify what differs from the above.

  3. removed
    webRelates to opencode on web / desktop
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  4. rocordov commented on May 5, 2026

    @rocordov

    Workaround: we found that running a second opencode web instance on a different port (for session isolation) triggers this bug. The manifest 401 is cosmetic but the /global/event 401 crashes the UI with PasteTypeError, making the session page completely blank.

    Our workaround: the secondary server runs without auth (OPENCODE_SERVER_PASSWORD unset) and we don't open its web UI at all. Instead, we proxy session messages through our own API endpoint and display CoT in a custom modal.

    The underlying issue is that the auth middleware doesn't exempt static assets (site.webmanifest, favicon) or the SSE event stream (/global/event). Related to #12447 (closed) and #9206.

  5. rocordov commented on May 5, 2026

    @rocordov

    Workaround implemented: We found that the manifest/event 401 crash is triggered by Basic auth on the OpenCode web server. Our workaround: don't use auth on the isolated server instance (just the main server on 4096). The isolated server is headless — we proxy its session API through our own web.py endpoint and display CoT/chat in a custom modal.

    Root cause appears to be that the auth middleware doesn't exempt static assets (site.webmanifest, favicon) or the SSE event stream (/global/event). Related: #12447 (closed), #9206, #18302.

  6. added 3 commits that reference this issue on Jun 9, 2026
    d85a5cc
  7. github-actions commented on Jul 5, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 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