continue icon indicating copy to clipboard operation
continue copied to clipboard

Azure AI models using apiType: azure-openai is failing on release >1.1.52 with JSON.parse(...)?.error?.replace is not a function

Open thomaspmorgan opened this issue 1 year ago • 3 comments

Before submitting your bug report

Relevant environment info

- OS: WIN 11
- Continue version: >= 1.1.52
- IDE version: VS Code 1.101.0
- Model: gpt4o-mini or any gpt model
- config:
  
azure_defaults: &azure_defaults
  provider: azure
  apiBase: xxxx
  apiKey: ${{ secrets.AZURE_OPENAI_API_KEY }}
  apiVersion: '2025-01-31'
  contextLength: 4096  # Up to 128000 but lets start small. Default 2048.
  requestOptions:
    caBundlePath: ${{ secrets.CA_BUNDLE_PATH }}
  defaultCompletionOptions: 
    maxTokens: 2560
    temperature: 0.1

models:
  - name: Azure GovCloud GPT-4o-mini
    <<: *azure_defaults
    model: gpt-4o-mini
    env:
      deployment: gpt4omini
      apiType: azure-openai
      apiVersion: '2025-01-31'
    roles: [chat, edit, apply, summarize, rerank]
    capabilities: [tool_use, image_input]
    
  - name: Azure GovCloud GPT-4o (Omni)
    <<: *azure_defaults
    model: gpt-4o
    env:
      deployment: gpt4o
      apiType: azure-openai
      apiVersion: '2025-01-31'
    roles: [chat, edit, apply, summarize]
    capabilities: [tool_use, image_input]
  
  OR link to assistant in Continue hub:

Description

1.1.49 of the extension works. Any version >=1.1.52 and above is not working.

Behavior is any chat or agent query returns and error dialog, with this text: JSON.parse(...)?.error?.replace is not a function

To reproduce

Install latest version.

Any AzureAI configured models no longer work, and produce the above message.

Versions >=1.1.52 complain that env.apiVersion is not specified in the config file, but adding the apiVersion property in the yaml file underneath the model.env property causes the error to occur.

Log output

index.js:1534
{message: 'JSON.parse(...)?.error?.replace is not a function'}
message
: 
"JSON.parse(...)?.error?.replace is not a function"
[[Prototype]]
: 
Object
constructor
: 
ƒ Object()
hasOwnProperty
: 
ƒ hasOwnProperty()
isPrototypeOf
: 
ƒ isPrototypeOf()
propertyIsEnumerable
: 
ƒ propertyIsEnumerable()
toLocaleString
: 
ƒ toLocaleString()
toString
: 
ƒ toString()
valueOf
: 
ƒ valueOf()
__defineGetter__
: 
ƒ __defineGetter__()
__defineSetter__
: 
ƒ __defineSetter__()
__lookupGetter__
: 
ƒ __lookupGetter__()
__lookupSetter__
: 
ƒ __lookupSetter__()
__proto__
: 
(...)
get __proto__
: 
ƒ __proto__()
set __proto__
: 
ƒ __proto__()

thomaspmorgan avatar Jul 01 '25 19:07 thomaspmorgan

I have the same error with Codestral on autocomplete, but not in Chat. I am also using the Azure API.

The interesting thing is that one out of 50 requests was passing.

sbaechler avatar Jul 02 '25 11:07 sbaechler

I just made a PR here that will fix the parsing issue with the error so that there is a more clear description of what is happening. This is the best I've got for today, as I haven't reproduced the actual error yet:

https://github.com/continuedev/continue/pull/6428

Will have this in a pre-release tomorrow and I'm sure we can follow up quickly to fix the other part of this

sestinj avatar Jul 03 '25 05:07 sestinj

Latest release (1.1.56) solves this issue and allows o3-mini models. Thanks for fixing this!

thomaspmorgan avatar Jul 07 '25 13:07 thomaspmorgan