Skip to content

w is not an object #1045

Closed
Closed

Description

@kim0

I hit this a lot

Image

Activity

  1. self-assigned this
    on Jul 16, 2025
  2. thdxr commented on Jul 16, 2025

    @thdxr
    Member

    need a screenshot

  3. kim0 commented on Jul 16, 2025

    @kim0
    Author

    @thdxr a bit confused, I already added a screenshot of the error popup inside OC. Let me know if you need some other kind of a screenshot

  4. caseymatt commented on Jul 17, 2025

    @caseymatt

    I saw this error earlier today when attempting to use OpenRouter's qwen/qwen3-235b-a22b endpoint (via a custom config using OpenRouter's :shortcuts ):
    ~/.config/opencode/opencode.json:

    {
      "$schema": "https://opencode.ai/config.json",
      "provider": {
        "openrouter-shortcut": {
          "npm": "@ai-sdk/openai-compatible",
          "options": {
            "baseURL": "https://openrouter.ai/api/v1"
          },
          "models": {
            "qwen/qwen3-235b-a22b:nitro": {
              "id": "qwen/qwen3-235b-a22b:nitro",
              "name": "Qwen3-235B Nitro",
              "attachment": false,
              "reasoning": true,
              "temperature": true,
              "tool_call": true,
              "limit": {
                "context": 40000,
                "output": 40000
              }
            }
          }
        }
      }
    }

    Logs:

    INFO  2025-07-17T18:47:57 +10534ms service=session session=ses_7e6523bdfffeE1c7kR9nvlM0LC type=start-step part
    INFO  2025-07-17T18:47:57 +1ms service=bus type=storage.write publishing
    INFO  2025-07-17T18:47:57 +0ms service=bus type=message.part.updated publishing
    INFO  2025-07-17T18:47:57 +0ms service=session session=ses_7e6523bdfffeE1c7kR9nvlM0LC type=error part
    ERROR 2025-07-17T18:47:57 +0ms service=session session=ses_7e6523bdfffeE1c7kR9nvlM0LC error=Provider returned error
    INFO  2025-07-17T18:47:57 +0ms service=session session=ses_7e6523bdfffeE1c7kR9nvlM0LC sessionID=ses_7e6523bdfffeE1c7kR9nvlM0LC unlocking
    INFO  2025-07-17T18:47:57 +0ms service=bus type=session.idle publishing
    INFO  2025-07-17T18:47:57 +0ms service=server duration=10575 response
    INFO  2025-07-17T18:47:57 +1ms service=server method=POST path=/log request
    ERROR 2025-07-17T18:47:57 +0ms service=tui failed to send message: POST "http://127.0.0.1:59217/session/ses_7e6523bdfffeE1c7kR9nvlM0LC/message": 400 Bad Request {"name":"UnknownError","data":{"message":"TypeError: w is not an Object. (evaluating '\"name\"in w')"}}
    

    The exception is complaining that isInstance() is being passed a String primitive, and in only works with objects, so it's throwing a TypeError. The primitive string type originates in the AI SDK: (1), (2)

    The "Provider returned error" failure itself seems to be related to OpenRouter. I can't reliably reproduce it, but it looks like there's supposed to be some metadata attached with the result (is AI SDK is stripping that out?). Some googling says that error might just be model availability / rate limiting on their side.

  5. trufae commented on Jul 19, 2025

    @trufae
    Contributor

    same error here. the error is "gone" if i just set "tool":false in the config file for that specific model (served via lmstudio).

  6. trufae commented on Aug 7, 2025

    @trufae
    Contributor

    same error here, disabling tool just makes opencode unable to achieve anything so its not a solution. happens with any local model with ollama or lmstudio

  7. trufae commented on Aug 7, 2025

    @trufae
    Contributor

    @caseymatt do you have a fix for this bug in the code?

  8. trufae commented on Aug 8, 2025

    @trufae
    Contributor

    works fine when building from git, its an issue in the last release i guess

  9. rekram1-node commented on Dec 28, 2025

    @rekram1-node
    Contributor

    [automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!

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