TypeError: undefined is not an object (evaluating 'mode.type') #1640

Closed
opened 2026-02-16 17:31:54 -05:00 by yindo · 18 comments
Owner

Originally created by @alexeiz on GitHub (Sep 6, 2025).

Originally assigned to: @thdxr on GitHub.

Getting this error on version 0.6.4. Doesn't matter which model I choose (and I chose a mode that used to work before). Removing .cache/opencode didn't help.

Originally created by @alexeiz on GitHub (Sep 6, 2025). Originally assigned to: @thdxr on GitHub. Getting this error on version 0.6.4. Doesn't matter which model I choose (and I chose a mode that used to work before). Removing .cache/opencode didn't help.
yindo closed this issue 2026-02-16 17:31:54 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Sep 6, 2025):

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

  • #2012: Similar "TypeError: undefined is not an object" error with model/provider interaction
  • #1307: Same error pattern "TypeError: undefined is not an object (evaluating 'Q.model')" related to model configuration
  • #942: Same error "TypeError: undefined is not an object (evaluating 'U0.tokens.input')" suggesting broader model object issues

These issues all seem related to undefined model objects in version 0.6.4 and similar versions, suggesting a potential regression in model handling.

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Sep 6, 2025): This issue might be a duplicate of existing issues. Please check: - #2012: Similar "TypeError: undefined is not an object" error with model/provider interaction - #1307: Same error pattern "TypeError: undefined is not an object (evaluating 'Q.model')" related to model configuration - #942: Same error "TypeError: undefined is not an object (evaluating 'U0.tokens.input')" suggesting broader model object issues These issues all seem related to undefined model objects in version 0.6.4 and similar versions, suggesting a potential regression in model handling. Feel free to ignore if none of these address your specific case.
Author
Owner

@alexeiz commented on GitHub (Sep 6, 2025):

I have only two configuration files:

~/.config/opencode/opencode.json 
{
  "$schema": "https://opencode.ai/config.json",
  "theme": "one-dark"
}
~/.local/share/opencode/auth.json
{
  "openai": {
    "type": "api",
    "key": "..."
  },
  "requesty": {
    "type": "api",
    "key": "..."
  },
  "openrouter": {
    "type": "api",
    "key": "..."
  },
  "xai": {
    "type": "api",
    "key": "..."
  }
}
@alexeiz commented on GitHub (Sep 6, 2025): I have only two configuration files: ``` ~/.config/opencode/opencode.json { "$schema": "https://opencode.ai/config.json", "theme": "one-dark" } ``` ``` ~/.local/share/opencode/auth.json { "openai": { "type": "api", "key": "..." }, "requesty": { "type": "api", "key": "..." }, "openrouter": { "type": "api", "key": "..." }, "xai": { "type": "api", "key": "..." } } ```
Author
Owner

@alexeiz commented on GitHub (Sep 6, 2025):

Looks like it's caused by "requesty" in auth.json.

@alexeiz commented on GitHub (Sep 6, 2025): Looks like it's caused by "requesty" in auth.json.
Author
Owner

@rekram1-node commented on GitHub (Sep 6, 2025):

Looks like it's caused by "requesty" in auth.json.

So this only happens for requesty models right?

@rekram1-node commented on GitHub (Sep 6, 2025): > Looks like it's caused by "requesty" in auth.json. So this only happens for `requesty` models right?
Author
Owner

@rekram1-node commented on GitHub (Sep 6, 2025):

I can replicate it

@rekram1-node commented on GitHub (Sep 6, 2025): I can replicate it
Author
Owner

@rekram1-node commented on GitHub (Sep 6, 2025):

requesty doesn't have v5 support in their AI sdk: @requesty/ai-sdk

Maybe they have an openai compatible endpoint tho

@rekram1-node commented on GitHub (Sep 6, 2025): requesty doesn't have v5 support in their AI sdk: @requesty/ai-sdk Maybe they have an openai compatible endpoint tho
Author
Owner

@bb33bb commented on GitHub (Sep 6, 2025):

same error
need to login in again,
using github copilot

@bb33bb commented on GitHub (Sep 6, 2025): same error need to login in again, using github copilot
Author
Owner

@alexeiz commented on GitHub (Sep 7, 2025):

So this only happens for requesty models right?

Not just for requesty models, somehow the presence of requesty in auth.json makes other models to fail with this error too.

@alexeiz commented on GitHub (Sep 7, 2025): > So this only happens for `requesty` models right? Not just for requesty models, somehow the presence of requesty in auth.json makes other models to fail with this error too.
Author
Owner

@OpeOginni commented on GitHub (Sep 8, 2025):

Hey @alexeiz, was just checking out the issue, true the requesty models doesn't work, but to me all other models work without failing. To let requesty work if you really would like that it would be best to make an issue on their SDK telling them to switch to their OpenAI compatible settings on the Model.dev system Requesty Config, since I think only people from those teams are allowed to make these changes. Then it should work on opencode for now, at least till they push the AI SDK V5 from beta. Then again if you see the need.

@rekram1-node since requesty is one of the defaults you can choose from as in Models.dev is it possible to make updates to make them work, without their team coming in?

@OpeOginni commented on GitHub (Sep 8, 2025): Hey @alexeiz, was just checking out the issue, true the requesty models doesn't work, but to me all other models work without failing. To let requesty work if you really would like that it would be best to make an issue on their [SDK](https://github.com/requestyai/ai-sdk-requesty) telling them to switch to their OpenAI compatible settings on the Model.dev system [Requesty Config](https://github.com/sst/models.dev/blob/dev/providers/requesty/provider.toml), since I think only people from those teams are allowed to make these changes. Then it should work on opencode for now, at least till they push the AI SDK V5 from beta. Then again if you see the need. @rekram1-node since requesty is one of the defaults you can choose from as in Models.dev is it possible to make updates to make them work, without their team coming in?
Author
Owner

@rekram1-node commented on GitHub (Sep 8, 2025):

@OpeOginni we need to update models.dev to use the openai comptabible npm package instead of the one it currently uses

it looks like requesty is openai comptatible

@rekram1-node commented on GitHub (Sep 8, 2025): @OpeOginni we need to update models.dev to use the openai comptabible npm package instead of the one it currently uses it looks like requesty is openai comptatible
Author
Owner

@OpeOginni commented on GitHub (Sep 8, 2025):

@rekram1-node made an issue and PR, you can cross check if you can, and I guess we wait?

https://github.com/sst/models.dev/pull/191

@OpeOginni commented on GitHub (Sep 8, 2025): @rekram1-node made an issue and PR, you can cross check if you can, and I guess we wait? https://github.com/sst/models.dev/pull/191
Author
Owner

@rekram1-node commented on GitHub (Sep 8, 2025):

looks great, I am not a maintainer of that repo so I can’t merge it but that’s exactly the change I would do so thank you!

@rekram1-node commented on GitHub (Sep 8, 2025): looks great, I am not a maintainer of that repo so I can’t merge it but that’s exactly the change I would do so thank you!
Author
Owner

@rekram1-node commented on GitHub (Sep 8, 2025):

if you dont mind maybe do the same for cloudflare at models.dev too? Their ai sdk package doesnt support v5 properly last I checked

@rekram1-node commented on GitHub (Sep 8, 2025): if you dont mind maybe do the same for cloudflare at models.dev too? Their ai sdk package doesnt support v5 properly last I checked
Author
Owner

@OpeOginni commented on GitHub (Sep 8, 2025):

if you dont mind maybe do the same for cloudflare at models.dev too? Their ai sdk package doesnt support v5 properly last I checked

Looking at it, but it seems to need some sort of a larger change, mostly due to how the API looks It needs the user account ID added in it

Working on a potential way to make it work on OpenCode first without touching things like setting types on the Auth, if I can get something working ill post a PR here and update the PR on Models.dev

@OpeOginni commented on GitHub (Sep 8, 2025): > if you dont mind maybe do the same for cloudflare at models.dev too? Their ai sdk package doesnt support v5 properly last I checked Looking at it, but it seems to need some sort of a larger change, mostly due to how the API looks [It needs the user account ID added in it](https://developers.cloudflare.com/workers-ai/configuration/open-ai-compatibility/) Working on a potential way to make it work on OpenCode first without touching things like setting types on the Auth, if I can get something working ill post a PR here and update the PR on Models.dev
Author
Owner

@rekram1-node commented on GitHub (Sep 8, 2025):

sweet ty

@rekram1-node commented on GitHub (Sep 8, 2025): sweet ty
Author
Owner

@OpeOginni commented on GitHub (Sep 8, 2025):

@rekram1-node you can check them out, only issue with my implementation (on Opencode) is that we set the base URL twice

  • When Setting the API
  • As a Custom loader for Cloudflare-workers-ai

It should work with no issue, but if you see the need we can just keep one.

But feedback or simplification tips are welcome

@OpeOginni commented on GitHub (Sep 8, 2025): @rekram1-node you can check them out, only issue with my implementation (on Opencode) is that we set the base URL twice - When Setting the API - As a Custom loader for Cloudflare-workers-ai It should work with no issue, but if you see the need we can just keep one. But feedback or simplification tips are welcome
Author
Owner

@rekram1-node commented on GitHub (Sep 8, 2025):

what a g thank you

@rekram1-node commented on GitHub (Sep 8, 2025): what a g thank you
Author
Owner

@rekram1-node commented on GitHub (Dec 27, 2025):

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

@rekram1-node commented on GitHub (Dec 27, 2025): [automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1640