continuedev / continue

⏩ Continue is the leading open-source AI code assistant. You can connect any models and any context to build custom autocomplete and chat experiences inside VS Code and JetBrains
https://docs.continue.dev/
Apache License 2.0
18.62k stars 1.55k forks source link

.prompt command leading to RangeError: Invalid array length #2000

Open acstrahl opened 2 months ago

acstrahl commented 2 months ago

Before submitting your bug report

Relevant environment info

- OS: Windows 11 Home 22H2
- Continue: v0.8.46
- IDE: VSCode 1.92.1
- Model:
- config.json:

{
  "models": [
    {
      "model": "claude-3-5-sonnet-20240620",
      "contextLength": 200000,
      "title": "Claude 3.5 Sonnet",
      "apiKey": "",
      "provider": "anthropic"
    },
    {
      "model": "gpt-4o",
      "contextLength": 128000,
      "title": "GPT-4o",
      "systemMessage": "You are an expert software developer. You give helpful and concise responses.",
      "apiKey": "",
      "provider": "openai"
    }
  ],
  "customCommands": [
    {
      "name": "test",
      "prompt": "{{{ input }}}\n\nWrite a comprehensive set of unit tests for the selected code. It should setup, run tests that check for correctness including important edge cases, and teardown. Ensure that the tests are complete and sophisticated. Give the tests just as chat output, don't edit any file.",
      "description": "Write unit tests for highlighted code"
    }
  ],
  "allowAnonymousTelemetry": true,
  "embeddingsProvider": {
    "provider": "free-trial"
  },
  "reranker": {
    "name": "free-trial"
  },
  "docs": []
}

Description

Any time I try to use a slash command I get an error message ("Invalid array length"). I have tried different LLMs, continue release and pre-release, and different .prompt files, but all result in the same error. prompts were working for me early last week, so I'm not sure what happened.

To reproduce

No response

Log output

INFO Extension host (LocalProcess pid: 1960) is unresponsive.
localProcessExtensionHost.ts:275 Extension Host
localProcessExtensionHost.ts:276 Debugger attached.
log.ts:419  INFO UNRESPONSIVE extension host: starting to profile NOW
log.ts:439   ERR [Extension Host] Error handling webview message: {
  "msg": {
    "messageId": "aed46bd9-ced7-440d-9f19-fc4f1db53495",
    "messageType": "command/run",
    "data": {
      "input": "/new-prompt-file ",
      "history": [
        {
          "role": "user",
          "content": [
            {
              "type": "text",
              "text": "/new-prompt-file "
            }
          ]
        }
      ],
      "modelTitle": "Claude 3.5 Sonnet",
      "slashCommandName": "new-prompt-file",
      "contextItems": [],
      "historyIndex": 0,
      "selectedCode": []
    }
  }
}

RangeError: Invalid array length
console.ts:137 [Extension Host] Error handling webview message: {
  "msg": {
    "messageId": "aed46bd9-ced7-440d-9f19-fc4f1db53495",
    "messageType": "command/run",
    "data": {
      "input": "/new-prompt-file ",
      "history": [
        {
          "role": "user",
          "content": [
            {
              "type": "text",
              "text": "/new-prompt-file "
            }
          ]
        }
      ],
      "modelTitle": "Claude 3.5 Sonnet",
      "slashCommandName": "new-prompt-file",
      "contextItems": [],
      "historyIndex": 0,
      "selectedCode": []
    }
  }
}

RangeError: Invalid array length
y @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
B @ event.ts:1230
fire @ event.ts:1261
fire @ ipc.net.ts:652
K.onmessage @ localProcessExtensionHost.ts:378
notificationsAlerts.ts:42 Invalid array length
c @ notificationsAlerts.ts:42
(anonymous) @ notificationsAlerts.ts:28
B @ event.ts:1230
C @ event.ts:1241
fire @ event.ts:1265
addNotification @ notifications.ts:228
notify @ notificationService.ts:253
(anonymous) @ mainThreadMessageService.ts:86
f @ mainThreadMessageService.ts:51
$showMessage @ mainThreadMessageService.ts:45
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
B @ event.ts:1230
fire @ event.ts:1261
fire @ ipc.net.ts:652
K.onmessage @ localProcessExtensionHost.ts:378
log.ts:419  INFO Extension host (LocalProcess pid: 1960) is responsive.
log.ts:419  INFO UNRESPONSIVE extension host: received responsive event and cancelling profiling session
log.ts:429  WARN UNRESPONSIVE extension host: 'vscode.git' took 97.14859063557336% of 698.579ms, saved PROFILE here: 'file:///c%3A/Users/username/AppData/Local/Temp/exthost-290192.cpuprofile'
Patrick-Erichsen commented 2 months ago

@acstrahl could you share your prompt file?

I just tried creating a sample prompt file, ./prompts/test.prompt with the following content:

what is your name?

Running v0.9.196 (pre-release), I was able to invoke the slash command.

acstrahl commented 2 months ago

GitHub won't allow for a .prompt fileshare, but here are the details:

./prompts/fail_numpandas_version_checker.prompt

Content:

temperature: 0.3
maxTokens: 4096
---
<system>
You are an expert programmer and educator who excels in pinpointing issues with Numpy and pandas versioning in Python code. You have been tasked with reviewing a Python script that uses Numpy and pandas to ensure that all code is compatible with the latest versions of these libraries.
</system>

{{{ input }}}

We are updating content to use the latest versions (numpy==2.0.1 and pandas==2.2.2). At least one section resulted in an error when I tried to run the code with the latest versions. Identify what caused the error and suggest a way to fix it. Additionally, can you please go section by section through the file and check for any content that is obsolete and/or deprecated in the v2+ versions of numpy and pandas?
alexcflopes commented 3 weeks ago

I am experiencing the same problem, but in mac version. After invoking the slash command the shows "Invalid array length" message and the chat window resumes for asking a follow-up". Tried different continue versions (older and newest). Even simple .prompt files like "write a joke" do not work. In another device (Windows) it works fine on every plugin version.

alexcflopes commented 3 weeks ago

@acstrahl any thoughts on the issue still ocurring on mac vscode plugin?