continuedev/continue

Enabling Prompt Caching Throws "crypto is not defined" Error

Closed this issue ยท 5 comments

Before submitting your bug report

Relevant environment info

- OS: Ubuntu 22.04.5 LTS
- Continue version: 1.0.44-eap
- IDE version: PhpStorm 2025.2 (Build #PS-252.23892.419)
- Model: Anthropic Claude Sonnet 4
- config:

%YAML 1.1
---
name: IntelliJ
version: 0.0.1
schema: v1
config_defaults: &config_defaults
  provider: bedrock
  env:
    region: us-east-1
    profile: bedrock
anthropic_model_defaults: &anthropic_model_defaults
  roles:
    - chat
    - edit
    - apply
  defaultCompletionOptions:
    contextLength: 200000
    maxTokens: 64000
    promptCaching: true
  capabilities:
    - tool_use
    - image_input
  reasoning: true
  reasoningBudgetTokens: 3000
models:
  - name: Claude 4 Sonnet Bedrock
    <<: *config_defaults
    <<: *anthropic_model_defaults
    model: us.anthropic.claude-sonnet-4-20250514-v1:0

  - name: Claude 3.7 Sonnet Bedrock
    <<: *config_defaults
    <<: *anthropic_model_defaults
    model: us.anthropic.claude-3-7-sonnet-20250219-v1:0

embeddingsProvider:
  <<: *config_defaults
  model: amazon.titan-embed-text-v2:0
  roles:
    - embed

Description

When I enable promptCaching for Claude Sonnet 4, all inference requests fail and I receive the following error in the Continue logs:
"crypto is not defined."
I also tried uninstalling the Continue plugin and deleting the ~/.continue directory. After reinstalling and adding my config.yaml file, the same problem occurred. Please investigate and fix this error.

NOTE: Commenting out promptCaching: true in the config.yaml file and restarting PHPStorm is a work around that fixes the issue.

Image

To reproduce

  1. Add Claude Sonnet 4 model in the config.yaml file.
  2. Be sure to add promptCaching: true to the model
  3. Save the config.yaml file
  4. Run an inference request
  5. Error message is displayed by the Continue plugin: "crypto is not defined"

Log output

[info] Starting Continue core...
[2025-09-17T12:51:30] [info] Starting Continue core... 
[2025-09-17T12:51:30] Setup 
[2025-09-17T12:51:30] [binary] Core started 
[2025-09-17T12:51:52] ReferenceError: crypto is not defined 
[2025-09-17T12:51:52] Error running handler for "llm/streamChat":  ReferenceError: crypto is not defined

I tried the following config and did not get any error:

models:
  - uses: anthropic/claude-4-sonnet
    with:
      ANTHROPIC_API_KEY: <key>
    override:
      defaultCompletionOptions:
        promptCaching: true

@Patrick-Erichsen I wonder if it's a bedrock specific issue?

๐ŸŽ‰ This issue has been resolved in version 1.19.1 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€

Thank you for resolving this issue. I wanted to confirm that hotfix 7938 fixed my issue. Thanks again!

๐ŸŽ‰ This issue has been resolved in version 1.22.0 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€